0

I have dojo form which is being submitted using Enter button.

I want to prevent from this event to to be called from all of the form elements in my form (when clicking on enter).

I tried this code:

dojo.connect(form, "onsubmit", function(evt) {
    evt.preventDefault();
    window.history.back();
});

For some reason my continue button (which is the submit action) turns to be disabled.

What can I do in order to prevent from this issue to happened ?

roeygol
  • 4,908
  • 9
  • 51
  • 88
  • You shouldn't prevent enter from working normally. The good question to ask yourself is **why do you want to go against normal behavior ?** – QuentinC Feb 04 '20 at 15:53
  • @QuentinC it's related to accessibility mode on our web platform, so we need to prevent enter click while the user is on any form element – roeygol Feb 04 '20 at 16:15
  • could you elaborate more on why you want to prevent pressing enter for accessibility mode, im with @QuentinC it sounds like you are trying to work around a different accessibility problem as the enter key is expected to submit, if you can't press enter to submit then it is expected that the submit button is disabled. Just trying to get a better understanding of what you need as it could be that there is a different / better solution to the overall problem. Oh and to stop submit do you not need to return `false` like in a normal javascript submit function? – GrahamTheDev Feb 05 '20 at 00:11

0 Answers0