After playing around with it I found the following jQuery workaround which worked for me:
event.preventDefault();
If anyone knows a better solution, please share it with the rest of us
Hi Themos,
nice workaround. I've done this before by writing my validate function in js (e.g. validateOnSubmit()) and then configured my submit buttons "Client click" option with:
return validateOnSubmit()
Only if the function returns true, the form will be submitted. This may be a more "standard" version but not necessarily a "better" one.
Regards
Philipp
Hey Philipp,
Nice solution, I hadn't thought of that!
Still, the ideal scenario would be to not even have to attach anything to specific buttons...
i.e. add the validation to the .submit() function, and prevent the submission from there!
Unfortunately, any code appended from javascript is executed AFTER the form gets posted back
so we have to attach the function to the specific button... Unless we can change the order of attached functions?!