Preventing Block Add/Edit Dialog submitting with jQuery
Permalink
I am trying to do some jquery validation of a block add/edit dialog and prevent the dialog submitting if validation fails.
My code boils down to:
The submit handler is firing (checked it with alert() inserted in various places), my code is running, but the form is getting submitted regardless of whether validation passes or not.
Similar code has worked in many other situations, but this is the first time I have done this in a C5 block add/edit dialog.
Has anyone experienced similar?
Are there any other ways to prevent a C5 add/edit dialog from submitting?
Is there a bug?
My code boils down to:
// check add/edit dialog on submit $('#div_in_my_edit_dialog').closest('form').submit(function(ev){ if (validate_ok()){ return true; } else { ev.preventDefault(); return false; } });
The submit handler is firing (checked it with alert() inserted in various places), my code is running, but the form is getting submitted regardless of whether validation passes or not.
Similar code has worked in many other situations, but this is the first time I have done this in a C5 block add/edit dialog.
Has anyone experienced similar?
Are there any other ways to prevent a C5 add/edit dialog from submitting?
Is there a bug?
You can also configure the strings that it returns in the block controller.