How to conditionally display different form confirmation dialog based on form selection

  • 26 November 2020
  • 6 replies
  • 215 views

Hello expert community.

I’m hoping to get some assistance for my form build. I’m wondering if I could populate different form confirmation dialogs based on what the user selects in the actual form drop down lists.

Thanks again for the help!


6 replies

Badge +1

hi @chrissjang there is already a solution posted in the community earlier. See here:

hey @Malik thanks for that. I guess where i’m stuck is after designating the variable as per the user selection in the form field.

Rather than showing as a dynamic text, I’m hoping to show different URLs based on the selection. Anybody know if this is possible?

For example, if user selects “e-books”, i’d like to show them a link to download the e-book, whereas if user selects “learn more”, i’d like to populate a Calendly link to book a meeting.

Userlevel 2
Badge +1

As @Malik mentions in the answer to my question on the linked thread, you can define what you want to show before calling the confirmation dialog and pass that (in your case a URL) through the parameters.

@GregorySR thanks, I understand the defining part but I’m not sure how to pass different URLs through the parameters dependent on if statements. I’ve never used javascript before so please pardon my lack of expertise 😦

I’ve also tried this (got it from support team), but it’s not working as well. Did anyone have any success using this?

Step 1. Add a form to the page and choose the default form action of “show form confirmation dialogue”
Step 2. Add a dropdown field to the form and make note of the ID. You will need to add options in the dropdown field to assign a URL to.
Note: You can change the ID to be form_destination in order for the script to work by default.
Step 3. Leave the first option of the dropdown blank
Step 4. Add a hidden field to your form and give it an ID of “destination”
Step 5. Add the first javascript snippet to the MAIN PAGE - Edit the script by replacing the URLs in with URLs of your own
(https://gist.github.com/RobertCam/15990124d7b9622e0503422e7305c8c5)
Step 6. Add the second snippet to the javascript section of the FORM CONFIRMATION DIALOGUE
(https://gist.github.com/RobertCam/3b3de761d3887b4ea92b36468bbea1a7)

Badge +1

@chrissjang what you got from the support team are scripts for redirecting to different pages depending on the dropdown selection. However, if i understand it right, you only want to show the links in the form confirmation dialog. is that correct?

In the script I have posted in another thread, you could place an if statement like this:
if (dropdown.value == “ebook”) {
url.value = “ebook-url”;
} else if (dropdown.value == “calendly”) {
url.value = “calendly-url”;
}
});

Then you can use the URL.value as dynamic text which will change the URL…

DM me for an explanation as this thread will only become confusing for future readers otherwise.

Reply