Prevent form submit on enter without JavaScript
This commit is contained in:
parent
4433041d0d
commit
c9176f96ac
@ -64,8 +64,6 @@ export const DataEntryInput: React.FC<TextDataEntryInputProps & {value?: string}
|
||||
placeholder={props.placeholder}
|
||||
onKeyDown={e => {
|
||||
if(e.keyCode === 13) {
|
||||
// prevent form submit on enter
|
||||
e.preventDefault();
|
||||
if(props.confirmOnEnter) {
|
||||
handleConfirm();
|
||||
}
|
||||
|
@ -364,6 +364,8 @@ const withCopyEdit: (wc: React.ComponentType<CategoryViewProps>) => DataContaine
|
||||
action={`/edit/${this.props.cat}/${this.props.building.building_id}`}
|
||||
method="POST"
|
||||
onSubmit={this.handleSubmit}>
|
||||
{/* this disabled button prevents form submission on enter - see https://stackoverflow.com/a/51507806/1478817 */}
|
||||
<button type="submit" disabled style={{display: 'none'}}></button>
|
||||
{
|
||||
(this.props.mode === 'edit' && !this.props.inactive) ?
|
||||
<div className='edit-bar'>
|
||||
|
Loading…
Reference in New Issue
Block a user