Title: Nav Link Functionality with Gravity Forms
Last modified: May 3, 2018

---

# Nav Link Functionality with Gravity Forms

 *  Resolved [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * (@marjwyatt)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/nav-link-functionality-with-gravity-forms/)
 * Server Environment:
    PHP Version 5.6.31
 * The site is running WordPress 4.9.5. It has been themed with the StudioPress 
   Digital Pro Theme so the Genesis Framework is installed. I’m also using Gravity
   forms with the Zapier Addon so I can store entries from the completed form onto
   a Google Sheet.
 * I’m using your WP Popup Maker plugin and I’ve also purchased the Forced Interaction
   extension to use with it.
 * I’ve reviewed this documentation:
    [https://docs.wppopupmaker.com/article/225-close-popup-and-create-cookie-after-gravity-forms-submission](https://docs.wppopupmaker.com/article/225-close-popup-and-create-cookie-after-gravity-forms-submission)
   [https://docs.wppopupmaker.com/article/46-how-to-close-a-popup-when-form-is-submitted](https://docs.wppopupmaker.com/article/46-how-to-close-a-popup-when-form-is-submitted)
   [https://docs.wppopupmaker.com/article/51-open-a-popup-from-a-wordpress-nav-menu](https://docs.wppopupmaker.com/article/51-open-a-popup-from-a-wordpress-nav-menu)
   [https://docs.wppopupmaker.com/article/350-popup-settings-box-triggers-option-settings](https://docs.wppopupmaker.com/article/350-popup-settings-box-triggers-option-settings)
 * The goal is to have a site visitor complete a “VIP Form” before they are redirected
   to the page they originally requested from the main menu link so we can populate
   the destination form with content from the VIP Form. We want to set a cookie 
   at the time of form completion/submission that will last for a user defined time
   frame.
 * I’m trying to get the plugin to behave with a menu link from the main menu and
   still have that same menu link deliver the site visitor to the page they originally
   requested. WP Popup Maker does bring up the Gravity Form and it will set the 
   cookie but the behavior is not as anticipated and seems problematic (i.e., not
   user friendly) because the visitor would have to click the navigation link again
   to get where they originally wanted to go.
 * The only condition available for setting the cookie seems to be Gravity Form 
   Success. The next problem is that the popup plugin does not redirect to the page
   the navigation link would otherwise send the visitor to.
 * If I change the Gravity Form Confirmation to redirect to the originally requested
   menu link after completing the VIP Form, WP Popup Maker doesn’t register the 
   form completion as being a Gravity Form Success.
 * The only link that I’ve enabled with the test popup is the “Get Pre-Qualified
   Instantly” link on the top menu.
 * I’m sort of at my wit’s end on how to sort this out and I am sure hoping you 
   can give me some meaningful guidance.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fnav-link-functionality-with-gravity-forms%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * (@marjwyatt)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/nav-link-functionality-with-gravity-forms/#post-10244468)
 * I guess I found a workaround for this issue but it isn’t really pretty. I haven’t
   applied the fix to the site link I provided above yet but I have it working locally
   in Xampp.
 * I had to add this code to the theme’s functions.php file:
 *     ```
       add_filter( 'gform_confirmation_7', 'custom_confirmation_message', 10, 4 );
       function custom_confirmation_message( $confirmation, $form, $entry, $ajax ) {
           $confirmation = 'Thank you for providing your information.  You will now be redirected to the page you requested' .
                           "<script>
                           /**
                           * Here you can simply change 967 to match your Popup ID #.
                           * The cookies settings will be determined the settings in the editor.
                           * Any trigger ( auto open, exit intent or scroll triggered ) that is
                           * Set to manual will have its cookie set using it's unique settings.
                           */
                           jQuery('#popmake-92').trigger('pumSetCookie');
   
                           /**
                           * Close the popup after a 2 second delay.
                           */
                           setTimeout(function () {
                           jQuery('#popmake-92').popmake('close');
                           }, 2000) // 5 seconds
                           window.self.jQuery( document ).ready(function() {
           window.self.jQuery(document).bind('gform_confirmation_loaded', function () {window.open('http://localhost/drivelawrence/quick-qualify/{$entry['10']}');});
       });
       </script>";
   
           return $confirmation;
       }
       ```
   
 * The confirmation message encoded into that function doesn’t ever appear but the
   cookie does get set according to the settings setup in the plugin.
 * I referenced this link for to enable the script method on a cookie:
    [https://docs.wppopupmaker.com/article/225-close-popup-and-create-cookie-after-gravity-forms-submission](https://docs.wppopupmaker.com/article/225-close-popup-and-create-cookie-after-gravity-forms-submission)
 * I referenced this link for help with the Gravity Forms part of the script:
    [https://docs.gravityforms.com/gform_confirmation/#3-output-script-with-confirmation-message](https://docs.gravityforms.com/gform_confirmation/#3-output-script-with-confirmation-message)
 * It appears that I will have to create different forms for each navigation link
   using this method. I guess WP Popupmaker only will present a popup on a nav link
   but it doesn’t go beyond that to make the nav link functional without the code.
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/nav-link-functionality-with-gravity-forms/#post-10300161)
 * [@marjwyatt](https://wordpress.org/support/users/marjwyatt/) – Pretty sure we
   worked this out via facebook or email support. If so can you please mark this
   resolved?
 *  Thread Starter [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * (@marjwyatt)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/nav-link-functionality-with-gravity-forms/#post-10301512)
 * The solution we discussed in email was not the solution that was implemented 
   at the site. After learning how Gravity Forms constructed a link for a form using
   Merge Tags, I came up with this:
 *     ```
       /* Redirect link after VIP Form Confirmation
        * Ref link: https://docs.gravityforms.com/gform_confirmation/
       */
       add_filter( 'gform_confirmation', 'custom_confirmation', 10, 4 );
       function custom_confirmation( $confirmation, $form, $entry, $ajax ) {
           /* VIP Quick Qual App */
           if( $form['id'] == '7' ) {
           $fname = rgar( $entry, '7' );
           $lname = rgar( $entry, '8' );
           $phone = rgar( $entry, '2' );
           $email = rgar( $entry, '3' );
           $redirect_url = rgar( $entry,'5');
           $goto = $redirect_url . '/?first_name=' . $fname . '&last_name=' . $lname . '&phone=' . $phone . '&email=' . $email;
           $confirmation =
                       "<script>
                           /**
                           * Here you can simply change 132 to match your Popup ID #.
                           * The cookies settings will be determined the settings in the editor.
                           * Any trigger ( auto open, exit intent or scroll triggered ) that is
                           * Set to manual will have its cookie set using it's unique settings.
                           */
                           jQuery('#popmake-132').trigger('pumSetCookie');
   
                           /**
                           * Close the popup after a 2 second delay.
                           */
                           setTimeout(function () {
                           jQuery('#popmake-132').popmake('close');
                           }, 500) // one-half second
                           window.top.jQuery( document ).ready(function() {
                               window.top.jQuery(document).bind('gform_confirmation_loaded', function () {window.open('$goto{$entry['10']}');});
                           });
                       </script>" . 'Thank you for completing the form.';
           }
           /* VIP Finance App */
           elseif( $form['id'] == '8' ) {
           $fname = rgar( $entry, '7' );
           $lname = rgar( $entry, '8' );
           $phone = rgar( $entry, '2' );
           $email = rgar( $entry, '3' );
           $redirect_url = rgar( $entry,'5');
           $goto = $redirect_url . '/?first_name=' . $fname . '&last_name=' . $lname . '&phone=' . $phone . '&email=' . $email;
           $confirmation =
                       "<script>
                           /**
                           * Here you can simply change 137 to match your Popup ID #.
                           * The cookies settings will be determined the settings in the editor.
                           * Any trigger ( auto open, exit intent or scroll triggered ) that is
                           * Set to manual will have its cookie set using it's unique settings.
                           */
                           jQuery('#popmake-137').trigger('pumSetCookie');
   
                           /**
                           * Close the popup after a 2 second delay.
                           */
                           setTimeout(function () {
                           jQuery('#popmake-137').popmake('close');
                           }, 500) // one-half second
                           window.self.jQuery( document ).ready(function() {
                               window.self.jQuery(document).bind('gform_confirmation_loaded', function () {window.open('$goto{$entry['10']}');});
                           });
                       </script>" . 'Thank you for completing the form.';
           }
           return $confirmation;
       }
       ```
   
 * This is imperfect, however. Google is treating the resulting link as if it is
   a redirect and browsers (Firefox and Chrome) are blocking that transition to 
   the form where the fields are supposed to be pre-poulated.
 * When the so-called popup from the constructed link is authorized in Firefox, 
   the process completes and the form fields are properly pre-populated. Chrome 
   doesn’t behave the same way. On a mobile (Android) device using Chrome, it just
   works.
 * Before I close this topic, I’d like to better understand why your plugin doesn’t
   see a form confirmation with merge tags as being a Gravity Forms Success on submit.
   You alluded to that in your email response but you didn’t fully explain the “
   why” of it.
 *  Thread Starter [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * (@marjwyatt)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/nav-link-functionality-with-gravity-forms/#post-10301518)
 * P.S. When I set up a dummy Gravity Form with confirmation of page redirect using
   merge tags to pre-populate the destination form fields, neither Google or Chrome
   block the process on form submit.
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/nav-link-functionality-with-gravity-forms/#post-10301584)
 * [@marjwyatt](https://wordpress.org/support/users/marjwyatt/) – To clear up what
   you asked, we don’t see it that way. Gravity Forms does. When you enable the 
   redirect action on success, they don’t trigger the forms JS success event (a 
   javascript version of add_action). So we have no way of detecting it. When you
   disable redirect and show a confirmation message they trigger an event we can
   use.
 * Not something we can control on our end ultimately, we are at the whim of their
   creation 😉
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/nav-link-functionality-with-gravity-forms/#post-10301594)
 * [@marjwyatt](https://wordpress.org/support/users/marjwyatt/) – The redirect stuff
   is more a question for Gravity Forms as it works the same in or out of a popup.
   The only question is how to both redirect and properly set a cookie to disable
   the popup.
 * I will see if I can get some input from their support on possibly adding an event
   in the future.
 * That said don’t count on it, for the reason you noticed. Browsers won’t always
   allow JS based link actions. That is not opening new tabs or changing the URL
   without user interaction.
 * For instance, if you click a button and js on that button redirects you to another
   page, that will work, it was a user-initiated click that started it all and the
   redirect happened quickly after the click.
 * Now if you did some ajax routine on click of that button and it took a few seconds,
   and after you redirect, the browser could assume it wasn’t the click of the button
   that triggered the redirect and blocks it.
 * This generally doesn’t apply to window.location = “” in javascript which was 
   the solution I mentioned in that you build the url in the confirmation text itself
   via the admin not a filter.
 * Using confirmation of something like this should make it simple:
 *     ```
       <script>
       window.location = "https://yoursite.com/page?arg1={{field_1}}&arg2={{field_2}}";
       </script>
       ```
   
 * Be sure to disable auto-formatting of the confirmation text.
 * Basically, the same thing your doing but easier to manage, also basically the
   same thing the redirect action does except it triggers the event Popup Maker 
   needs as well.
 * Hope that helps.
 *  Thread Starter [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * (@marjwyatt)
 * [8 years ago](https://wordpress.org/support/topic/nav-link-functionality-with-gravity-forms/#post-10320372)
 * Thanks for your reply, Daniel. I’m sorry it took me so long to find the email
   notification.
 * I’m afraid I’m not following your latest suggestion. Are you saying that I should
   add that script to the Gravity Forms Default Confirmation within the WordPress
   dashboard? Or, are you saying that I should update the script that I’ve already
   embedded in functions.php for the confirmation?
 * For the record, I tried a simple test of adding the script as a text confirmation
   to a duplicated form and it didn’t appear to work.
 * I hear you on holding out hope that Gravity Forms will respond. I opened a ticket
   with them near our around the time that I first put in a support request to you
   and it took them over a week to reply. Their reply simply asked me to restate
   what I had already told them.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Nav Link Functionality with Gravity Forms’ is closed to new replies.

 * ![](https://ps.w.org/popup-maker/assets/icon-256x256.gif?rev=3097653)
 * [Popup Maker - Boost Sales, Conversions, Optins, Subscribers with the Ultimate WP Popup Builder](https://wordpress.org/plugins/popup-maker/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/popup-maker/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/popup-maker/)
 * [Active Topics](https://wordpress.org/support/plugin/popup-maker/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/popup-maker/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/popup-maker/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/nav-link-functionality-with-gravity-forms/#post-10320372)
 * Status: resolved