client_side_validations
client_side_validations copied to clipboard
turn off validation for a submit button
I have an edit form with [Save] [Delete] [Cancel] buttons. When Delete/Cancel are clicked, I want the form to submit even if invalid.
c_s_v handles form.onsubmit so the form is always validated when any submit button is clicked or the Enter key is pressed. One solution is to handle button.onclick and Enter.onkeyup instead. If a button contains :validate => false, don't bind onsubmit.
You will need to use $.die('form') to remove the events. This is a failing of the current public API and will be addressed in 4.0 of the gem