• 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:

    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 Pending

    e.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 invalid

    e.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

    (@dnesscarkey)

    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)
  • You must be logged in to reply to this topic.