Title: Validation scroll issue
Last modified: December 16, 2024

---

# Validation scroll issue

 *  [Saskia Teichmann](https://wordpress.org/support/users/jyria/)
 * (@jyria)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/validation-scroll-issue/)
 * Hello there!
 * There are cases, when your”scroll to erronous field” feature on submit button
   click is not working correctly.
 * For example, if the tag with .wpcf7-form-control does not also contain class .
   error
   This is the case when using checkbox groups.
 * Then your validation script is unable to find a tag with .wpcf7-form-control.
   error and scroll to that field won’t work.
 * I modified your script to make it work in al scenarios- Please make sure to update
   your plugin and implement this change! Thanks a lot:
 * file modified: 
   **/jquery-validation-for-contact-form-7-pro/includes/assets/js/
   jvcf7p_validation.js**
 * corrected lines:
 *     ```wp-block-code
       jQuery('.wpcf7-form-control.wpcf7-submit').click(function(e){$jvcfpValidation = jQuery(this).parents('form');jQuery($jvcfpValidation).valid();if (jQuery($jvcfpValidation).validate().pendingRequest != 0){ // is Remote Call is Pendinge.preventDefault();$topPendingPosition = jQuery('.wpcf7-form-control.pending').offset().top;$topPendingPosition = parseInt($topPendingPosition) - 100;jQuery('body, html').animate({scrollTop:$topPendingPosition}, 'normal');}if (!jQuery($jvcfpValidation).valid()){ // If form invalide.preventDefault();var $errorElement = $jvcfpValidation.find('.error').eq(0);var scrollTarget = $errorElement.length ? $errorElement.offset().top - 100 : jQuery($jvcfpValidation).offset().top - 100;jQuery('body, html').animate({scrollTop:scrollTarget}, 'normal');}});
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [Dnesscarkey](https://wordpress.org/support/users/dnesscarkey/)
 * (@dnesscarkey)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/validation-scroll-issue/#post-18205252)
 * Hi Saskia,
 * Thank you so much for your feedback and for providing the modified script! We
   will test it and aim to include this update in our next release. Your help in
   making our plugin better is greatly appreciated.
 * Best regards, Dinesh

Viewing 1 replies (of 1 total)

The topic ‘Validation scroll issue’ is closed to new replies.

 * ![](https://ps.w.org/jquery-validation-for-contact-form-7/assets/icon-128x128.
   png?rev=1113600)
 * [Jquery Validation For Contact Form 7](https://wordpress.org/plugins/jquery-validation-for-contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jquery-validation-for-contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jquery-validation-for-contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/jquery-validation-for-contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jquery-validation-for-contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jquery-validation-for-contact-form-7/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Dnesscarkey](https://wordpress.org/support/users/dnesscarkey/)
 * Last activity: [1 year, 5 months ago](https://wordpress.org/support/topic/validation-scroll-issue/#post-18205252)
 * Status: not resolved