PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Focus of Page For Validation

  1. is there a way to get the page to stay put when a validation occurs? If a form is in the footer and a user submits, the page pops back to the top. The form will either output a success message or an error, but the user may not know anything because the page has reset to the top and the form is no longer visible.

    Sorry if this is already covered. I couldn't find anything.

    Posted 14 years ago on Wednesday June 16, 2010 | Permalink
  2. Yes. You can manually add an anchor to your post body, then use a jQuery snippet to add the anchor reference to the form. That way, when the form submits and runs the validation, the page will return to the section with the form visible.

    This is something we plan to add to a future release, but for now, this works like a charm.

    http://forum.gravityhelp.com/topic/display-errors-at-top-of-page#post-4135

    Posted 14 years ago on Wednesday June 16, 2010 | Permalink
  3. begatt
    Member

    I can't seem to get the script correct...I know nothing about jQuery.

    <a name="validate"></a>
    [gravityform id=1 name=Survey title=false description=false]
    <script type="text/javascript">
      jQuery(document).ready(function() {
         jQuery("#id=1").attr("action", "#validate");
      });
     </script>

    Should it be "1" or "id=1" or "#1" or "#id=1"?

    And "validate" or "#validate"?

    Posted 14 years ago on Tuesday August 24, 2010 | Permalink
  4. for the form ID, you can view that in your source to get it (example). It needs to be exactly the same as in the source. The anchor you've added needs to be preceded with the # symbol.

    Basically it's telling the form to return back to that anchor (the #) when the form submits (the action) and the page reloads.

    Since I see your shortcode is for form 1, this should be what you need.

    <a name="validate"></a>
    [gravityform id=1 name=Survey title=false description=false]
    <script type="text/javascript">
      jQuery(document).ready(function() {
         jQuery("#gform_1").attr("action", "#validate");
      });
     </script>
    Posted 14 years ago on Wednesday August 25, 2010 | Permalink
  5. begatt
    Member

    Thank you Kevin, it works.

    Can I ask a similar question...when the submit button is clicked, the top of the form page appears for a second and then it goes to the redirect confirmation page.

    Is there a way to eliminate the top of the form from appearing again and instead it go right to redirect page, or some sort of spinning gear or something?

    http://cochristianhe.org/dads/confidence-survey/

    Posted 14 years ago on Wednesday August 25, 2010 | Permalink
  6. Yep, you can try this. It will eliminate the content flickr before the redirect page.

    http://forum.gravityhelp.com/topic/sidebar-disappears-on-form-submit#post-8965

    Posted 14 years ago on Wednesday August 25, 2010 | Permalink