Uniforms: Prevent submit when click ENTER

Created on 22 Sep 2018  路  2Comments  路  Source: vazco/uniforms

We are using react-selectize component for a field. In this component you can add custom tags. For this you have to type the word and click "ENTER".

Problem:
When clicking enter the form gets submitted. Is there a way to prevent this ? Maybe a hook where I can control if something triggers the submit or not. Example:

onSubmitRequest={(requestedBy) => {
return requestedBy === 'submitButtonClick';
}}

question

All 2 comments

Hi @TimoRuetten. There's no logic on what caused the submit - we just listen to onSubmit of the <form> element. To prevent this, you may use preventDefault at this very event.

Alright! Thats enough info. I already do this to prevent it. I was just thinking that maybe there is something build in. Thanks :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simplecommerce picture simplecommerce  路  6Comments

thearabbit picture thearabbit  路  8Comments

dacioromero picture dacioromero  路  5Comments

arrygoo picture arrygoo  路  3Comments

vfonic picture vfonic  路  3Comments