Disable submission of form when 'Enter' key is pressed

Hi Guys,

I’ve had a look around the forum and couldn’t really find a workable solution from stopping the form submitting when a user hits the ‘Enter’ key. I would like to stop the submission even when all inputs are valid. If there is any Javascript that can run either on a page basis or site-wide, that would be really helpful.

Related post

Disabling submission of text input when Enter is hit


Have you tried “hijacking” the enter key with the Air Keyboard Shortcuts plugin?

Or maybe you can try to have the button disabled when not hovered?


Hey @petter

Yes was thinking about this, would require adding to each form, we have quite a few. Then there is a slight issue of a workaround when the user wants to hit enter on a multi-line input, great suggestion though.

As for the disabled until hover, didn’t think of that one, interesting idea. Only not sure how this would pan out for mobile devices, will give it a shot though. Thanks.


@petter this is brilliant, I didn’t think of it :clap:

@luke2, The hover effect does not affect the mobile uses since the hover doesn’t apply on mobile devices.

It works fine I just tested it now :+1:

@luke2 Thanks for the question and @petter thanks for the brilliant answer. I just learned something new again today.


This does the trick quite nicely. Only issue is with mobile or tablet devices that do not have the hover state, but for that, perhaps the condition could be adapted to use ‘Current page width’ as well or better yet, use a plugin to get the device info and then depending device if mobile, then disregard the hover condition.

Tagging in @mxolisipn might be helpful for the above.



For other readers of this same problem, like me. A really silly workaround for mobile devices but tested it works: Set one of the “This button is pressed” properties to “This isn’t clickable” = unchecked. Luckily Bubble interprets both the condition change and the submission simultaneously. Used in conjunction with the same property on “Button is hovered” from @petter solves for all cases.

This thread was a huge help.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.