on submit, focus field with errors
Couldn't find a google group so pardon me if this isn't an "issue". (Thank you for this gem.)
I'm not sure what the issue is
When the user clicks a button while there are invalid fields, focus & scroll to one of the invalid fields.
On Monday, January 16, 2012, Brian Cardarella < [email protected]> wrote:
I'm not sure what the issue is
Reply to this email directly or view it on GitHub:
https://github.com/bcardarella/client_side_validations/issues/252#issuecomment-3523935
This is not a bug. You want to handle this through the callbacks.
https://github.com/bcardarella/client_side_validations/wiki/Callbacks
Thx for the advice.
clientSideValidations.callbacks.form.fail(function(form, eventData) { alert('Please read the red messages.'); $(".field_with_errors").children().css('background-color', 'purple'); });
My func doesn't seem to be called.
Solved it: Assignment instead of call. Thx again.
clientSideValidations.callbacks.form.fail = function(form, eventData) { alert('Please read the red messages.'); $(".field_with_errors").focus(); };