136
Views
2
Comments
Solved
Prevent form submit on enter is not working
Question

I have a text input,  this text input have a server action in the On Change Destination to do some stuff when the input value changes.

I want to prevent that the form is submitted if user presses enter in this input. So in the input element in Extended properties I add this:


onkeydown

 "return event.key != 'Enter;"


But its not working, when the enter is pressed the form is submitted. Do you know why? 

Solution

John Jake,


On your keydown event try to put the following code:


SyntaxEditor Code Snippet

"if (window.event.keyCode == 13 ) return false"


I tested and it should be enough to achieve what you are trying to do.


Best Regards,


João Delgado

thanks, it worked for me!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.