[DEV-95] add prevent default when pressing down Enter key (#1033)

* add prevent default when pressing down Enter key

* delete listener and add onkeydown prop
This commit is contained in:
Guillermo Giuliana 2021-09-15 14:21:19 -03:00 committed by GitHub
parent 89cb4c18fd
commit c22a1cdbb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,8 @@ class AdminPanelCustomFieldForm extends React.Component {
loading={loading}
values={addForm}
onChange={this.onAddFormChange.bind(this)}
onSubmit={this.onSubmit.bind(this)}>
onSubmit={this.onSubmit.bind(this)}
onKeyDown={(event) => { if(event.key == 'Enter') event.preventDefault()}}>
<FormField name="name" validation="NAME" label={i18n('NAME')} field="input" fieldProps={{size: 'large'}} required/>
<FormField name="description" label={i18n('FIELD_DESCRIPTION')} field="input" fieldProps={{size: 'large'}}/>
<FormField name="type" label={i18n('TYPE')} field="select" fieldProps={{size: 'large', items: [{content: i18n('TEXT_INPUT')}, {content: i18n('SELECT_INPUT')}]}} required/>
@ -86,7 +87,6 @@ class AdminPanelCustomFieldForm extends React.Component {
onAddOptionClick(event) {
event.preventDefault();
let addFormOptions = _.clone(this.state.addFormOptions);
addFormOptions.push("");