View The Space is Hiring

Tuesday, September 13, 2011

ScrollTo the first rails client_side_validation with JQuery

I was using the amazing client_side_validations gem with an extremely large form. Everything was working perfectly but since this was a large form, the inline validation errors were not on the screen when the user hit submit. As a result, it just appeared as though the form was not working. To fix this, we used the jquery ScrollTo plugin and client_side_validations callbacks to scroll to the first validation error:


2 comments:

  1. Hello!

    I'm very new to web development and this gem seems super useful but I'm confused as how to utilize the ClientSideValidations.callbacks.form.fail and link it up to the submit button. My design was to block submission until all errors are removed and it sounds like thats what you had in mind to. Thank you!

    ReplyDelete