client_side_validations icon indicating copy to clipboard operation
client_side_validations copied to clipboard

on submit, focus field with errors

Open kellerapps opened this issue 14 years ago • 5 comments

Couldn't find a google group so pardon me if this isn't an "issue". (Thank you for this gem.)

kellerapps avatar Jan 17 '12 05:01 kellerapps

I'm not sure what the issue is

bcardarella avatar Jan 17 '12 06:01 bcardarella

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

kellerapps avatar Jan 17 '12 08:01 kellerapps

This is not a bug. You want to handle this through the callbacks.

https://github.com/bcardarella/client_side_validations/wiki/Callbacks

bcardarella avatar Jan 17 '12 15:01 bcardarella

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.

kellerapps avatar Jan 17 '12 21:01 kellerapps

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(); };

kellerapps avatar Jan 18 '12 16:01 kellerapps