I have a form that submits a js query. If there is an error or a validity check fails in the js, how to do I prevent the form from thinking it has submitted successfully and doing things like resetting after submit?
Related, I can have multiple submit handlers (one for form submission, one to close model and so on.) Do all of these run in parallel or do they bubble? Is there a knowable order in which they execute? If I can fail one, can I prevent bubbling up to the rest?
js determines where the form is to be submitted and how based on the form contents.
If there is an error in the js or my js determines entries are incorrect, the js finishes but the form component keeps acting as if the form was successfully submitted by running the remaining submitted events and clearing the form.
I am looking for something that duplicates the html submit cancel capability like:
<form onsubmit="return isValidForm()" />
If isValidForm() returns true the form is submitted to the server. If it returns false, all processing stops.
I am guessing this should be moved over to feature requests.
Yeah, That would probably work perfectly. In fact I might just make that the standard pattern for all form submits from now on. You never know what might happen and having a way to roll back a submit is quite often very important.
It would still be nice to have a built way to handle this so I am moving this thread to feature requests.