Skip to content

Scroll to the first error

Geremia Taglialatela edited this page Feb 6, 2026 · 6 revisions

This is an example implementation, you may require more checks:

ClientSideValidations.callbacks.form.fail = function($form, eventData) {
  const settings = $form[0].ClientSideValidations.settings;
  const wrapperErrorClass = settings.html_settings.wrapper_error_class;
  const $errorElement = $form.find(`.${wrapperErrorClass}`);
  
  if ($errorElement.length) {
    $('html').animate({ 
      scrollTop: $errorElement.offset().top 
    });
  }
};

Clone this wiki locally