I have a form element that has a submit workflow linked to the form element. Right now, when my users click enter the form submits as the enter key triggers the submit workflow. This is not the behaviour that I want. I only want the form to submit when the user clicks the submit button contained within the form.
Is there a WeWebby way to achieve this? I’ve tried accessing the ‘event’ but this is null when using a submit workflow. I don’t want to convert the workflow to an on click event as I want to keep the form validations.
Set workflow in “Submit button” that changes additional variable “buttonClicked” == true. And on form submit add verification of buttonClicked variable state (true/false). Unfortunately that doesn’t work, cause the browser automatically “clicks” on the submit button on Enter key press.
Change the submit button type from “Submit button” to just “Button”. And in this button workflow add the “execute component action” >> “Submit form”. And keep in the submit form workflow the same check if the button was clicked. I expected this would solve the problem, but it wouldn’t. I get “null” in the result of “execute component action” >> “Submit form”.
The reason was that I put scripts inside page load workflows so they were initiated earlier than form was created. So I put the script inside “form” >> “on create” workflow.
My attempt to submit a form with “submit form” action was returning “null”, because there was no “submit button” inside the form. Therefore, an ordinary button with “type”=“button” couldn’t trigger “on submit”.
The only problem here is that I could see this warning only when I created a new form while debugging. So, if my conclusion is correct, maybe it’d be reasonable to display this warning message permanently?
Right now, it’s only visible when the button inside the form has “type”=“button” (and not “submit button”). But if there are no buttons inside the form at all, no warning message is shown.