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.

Form in a tab

  1. Aejandro
    Member

    Hello, my layout has tabs so I am using a tab to show the gravity form.

    The problem is when user submits the form, the page reloads not on the specific tab in order to see either the confirmation message or the incomplete alert message.

    Each tab has its own specific url so what would be the way to GF reloads on the specific tab url?

    Thank you

    Posted 11 years ago on Friday February 8, 2013 | Permalink
  2. Please provide a link to the site where we can see your form in action. Thank you.

    Posted 11 years ago on Saturday February 9, 2013 | Permalink
  3. Aejandro
    Member

    Sure, here it is: http://goo.gl/hQP40

    Thank you

    Posted 11 years ago on Saturday February 9, 2013 | Permalink
  4. I think the issue is in the form tag:

    <form method='post' enctype='multipart/form-data'  id='gform_1'  action='/tours/arequipa/'>

    Each tab does not actually have its own page URL: the unique part of the URL is an anchor tag in the same page. Gravity Forms submits to the page though. You can use the gform_form_tag http://www.gravityhelp.com/documentation/page/Gform_form_tag to modify the form action to the URL of the tab. That will work so long as that URL does not change.

    Posted 11 years ago on Saturday February 9, 2013 | Permalink
  5. Hello,

    I am having the same issue. I have form in multiple tabs. When the forms is submitted it default back to the first tab so the user does not see the 'form submit success' message.

    Please be more specific as to how to use the GForm_form_tag code to solve this issue.

    Thank you

    Posted 11 years ago on Wednesday March 13, 2013 | Permalink
  6. You would use the code on that page of documentation to change the form tag to submit to the URL of the tab you're on currently, which in the other user's case was a named anchor on the same page. So, you would need to find the URL of the tab, and change the code in that example to include the named anchor (the part including the #, like #tabbed_content1 maybe).

    Posted 11 years ago on Thursday March 14, 2013 | Permalink
  7. Could you give me a code example please!

    The anchor name for the tab is #tab-0

    <form method='post' enctype='??????' id='gform_1' action='#tab-0'> maybe??

    Where does this code go? functions.php? page.php?

    Thanks Kelsey

    Posted 11 years ago on Thursday March 14, 2013 | Permalink
  8. The code will go in your current theme's functions.php file.

    Try this:

    [php]
    <?php
    add_filter("gform_form_tag", "form_tag", 10, 2);
    function form_tag($form_tag, $form){
        // this will be applied to form 1 only
        if ($form['id'] == 1) {
        // you may have to add the page slug before the #tab-0 here
            $form_tag = preg_replace("|action='(.*?)'|", "action='#tab-0'", $form_tag);
        }
            return $form_tag;
    }
    Posted 11 years ago on Thursday March 14, 2013 | Permalink