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.

Custom Confirmation Redirects based on #input field

  1. For some reason my last post was closed without any answers. So here it is again. I really need help with this.
    I have been trying to accomplish redirecting people to a specific confirmation page based on #input_1_46 on my form. I saw this http://www.gravityhelp.com/forums/topic/custom-thank-you-page-based-on-select-field-choice and was trying to use the coding to accomplish this but it is not working at all.

    My form is: https://ineedapassport.com/passport-step2/?servicetype=New%20Passport&fee=170

    The code I have written is here: http://pastie.org/5453541

    Posted 11 years ago on Thursday November 29, 2012 | Permalink
  2. 2nd day my posts have been up with no answers. Can someone please help with this? It is important.

    Posted 11 years ago on Thursday November 29, 2012 | Permalink
  3. David Peralty

    Can you tell me what happens currently? I don't see anything wrong with your code that would stop things from working. Can you try just putting an exit(); in one of the conditions and confirm that your selections are actually "working"?

    Also, can you enable values on the field you are comparing against?

    Posted 11 years ago on Friday November 30, 2012 | Permalink
  4. David Peralty

    Actually, it looks like might need to be using the $form element rather than the $entry object.

    http://www.gravityhelp.com/documentation/page/Form_Object

    All my best!

    Posted 11 years ago on Friday November 30, 2012 | Permalink
  5. The code I provided in that earlier example contained an error. You should use $lead['46'] everywhere instead of $entry['46']. Since you're passing in the lead, and if the field number is 46, that's the way to check the value of it. See if that change works for you.

    Sorry about the mistake in my earlier example.

    Posted 11 years ago on Saturday December 1, 2012 | Permalink
  6. OMG CHRIS YOU ARE A GENIUS!!! It works. Thank you so much. I have been fretting and trying to figure this out for days.

    Posted 11 years ago on Monday December 3, 2012 | Permalink
  7. Ok one problem I just found. Now the redirect works but none of the string merge tags are being brought over to my confirmation page now. How do I fix that???

    Posted 11 years ago on Monday December 3, 2012 | Permalink
  8. You're going to have to handle the merge tags in the function now, rather than in the confirmation settings for the form, since you are changing the confirmation URL. It will work about the same way. You will pull values from each field, and build your query string. I would build that first, especially since it is likely to be the same no matter what URL? (if that's true, build the query string before the if statement. Then, after all your cases, append the query string.

    Something like this:

    [php]
    // insert this at line 3
    $qs = '?name=' . $lead['4'] . '&company=' . $lead['7'] . '&destination=' . $lead['12'];
    // then all your if statements
    // ...
    // then return the URL and the query string
    return $confirmation . $qs;

    You just have to merge all the values yourself since you are overriding a form setting with your function.

    Sorry again about the error in the original code.

    Posted 11 years ago on Monday December 3, 2012 | Permalink
  9. Ok. They way I have it to merge is using shortcodes like this: [urlparam param="name" /].

    How do I merge the values using this function?

    Posted 11 years ago on Tuesday December 4, 2012 | Permalink
  10. Also the only thing coming up now when I submit my form after adding the qs is:

    Array?name=Angela Williams&orderid=INAP51501426-----&dest=&type=New Passport&date=&service=Two Business Days|249&comment=

    My page is no longer there.

    Posted 11 years ago on Tuesday December 4, 2012 | Permalink
  11. You're using a shortcode rather than a built-in Gravity Form merge tag? And where are you using that shortcode? I need to see more how you're doing things to be able to help you. I am giving you general assistance at this point but I need more specifics from you.

    Posted 11 years ago on Tuesday December 4, 2012 | Permalink
  12. Ok I have a made confirmation page: http://ineedapassport.com/new-passport-confirmation/

    Where you see customer next to it would be the full name off of the gravity form. Order Number is the hidden order number field off the gravity form and so on. I was using a plugin to bring the string query into the page before I fixed the redirects. Now the redirects work I am trying to use gravity form merge tags to put the info into my confirmation page. I can't get it to work.

    Also after adding the $qs to my code my page doesn't even show up. I get a blank page with the string "Array?name=Angela Williams...."

    What other information do you need to help me? I would be happy to provide it.

    Posted 11 years ago on Tuesday December 4, 2012 | Permalink
  13. Ok I have figured out that the above qs string was breaking the whole redirect code. I noticed at the top it was the same url as my form, not the redirect url.

    Posted 11 years ago on Wednesday December 5, 2012 | Permalink
  14. Do you have everything working OK now?

    Posted 11 years ago on Thursday December 6, 2012 | Permalink
  15. No. I had to take the qs off because it was breaking the code. The redirect works but the query string code does not.

    Posted 11 years ago on Thursday December 6, 2012 | Permalink
  16. Ok had to go outside of this forum and pay someone to get help with this. Just in case someone else needs this information the answer is: http://pastie.org/5489476

    Posted 11 years ago on Thursday December 6, 2012 | Permalink
  17. Thank you for posting that code.

    Posted 11 years ago on Monday December 10, 2012 | Permalink