Is there a way to stop a form submitting when 'enter' is pressed?

Hey all,

Currently if a user hits enter/return on a form input - the form will submit. I think we can improve the UX of our specific scenario by disallowing this and instead triggering form submit on the array change.

Wondering if this is possible somehow?

Ok, solved this if anyone might find this useful, you can add the following to your form:

onkeydown="return event.key != 'Enter';"

If there is another way to do this, native to wappler UI - please let me know!

1 Like

If there is a submit button in your form, try changing its type to a regular button. And on click of that, set dynamic action of form.submit().

4 Likes

Good idea! Thank you @sid

Yes, good question and answer from @sid. I’d been thinking the same the other day. I have ctrl+enter mapped to submit forms but was wondering why some of them submitted with just enter… now I know

1 Like

I had to use @mgaussie suggestion with the onkeydown attribute. Thanks! :beers:

hi guys
any news about this ?