• Resolved andyfo

    (@andyfo)


    Hi!

    Is there a way to disable the error anchoring? (Rationale: in many cases an unexpected scroll, especially when all elements are in the viewport center, causes a user discomfort.)

    I found the scroll function in livevalidation_standalone.js around the line 915 but it seems the only way is to comment it out.

    Maybe the plugin could respect the gform_confirmation_anchor setting.

    Thanks for the plugin!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor wisetr

    (@wisetr)

    Hi @andyfo ,

    No, right now there is no method to disable this properly.

    But We really appreciate your contribution to the improvement of this plugin.

    Yes, we will surely consider this in our next upcoming version really soon. Please stay tuned.

    Thanks,
    Team Wisetr

    Thread Starter andyfo

    (@andyfo)

    Ok, thanks.

    For the time being, I hacked this by adding an informative css class into the Gravity form and by disabling the anchoring based on the presence of that css class.

    If someone wants to replicate:

    (1) I put this code inside my functions.php to include a css class gf_no_confirmation_anchor in a form if it’s set to no confirmation anchor:

    add_filter( 'gform_pre_render', 'confirmation_anchor_css_class' );
    function confirmation_anchor_css_class($form) {
      $use_anchor = gf_apply_filters( array( 'gform_confirmation_anchor', $form["id"] ), null, $form );
    
      if ($use_anchor === false) {
        $form['cssClass'] .= " gf_no_confirmation_anchor";
      }
    
      return $form;
    }
    

    (2) I added the following condition around the jQuery animate function in the plugin folder in public/assets/js/livevalidation_standalone.js around the line 915:

    if (!jQuery(self.element).hasClass("gf_no_confirmation_anchor")) {
        jqobjPrime('body,html').animate({
            scrollTop: moveTo
        }, 500);
    }
    

    But you have to pay attention to this hack when you are updating the plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable error anchoring (auto scroll)’ is closed to new replies.