Forum

Thread tagged as: Question, Forms

Displaying thank you page content depending on a specific form value

Hi,

I have a Perch form that includes a <select> element with four options. On form submission, I need to send through a Google Analytics script that is specific to the selected value of the <select>. I tried to use a <perch:if> within a <perch: success> block to check against the value of the <select>, but that didn't work. What would be the best way to achieve what I need?

Thanks in advance for any input and guidance.

Simon Kelly

Simon Kelly 0 points

  • 6 years ago

Have you tried displaying the form using either perch_content() or perch_content_custom()?

Hi Philip,

Thanks for your reply. No I haven't tried that. Would that approach allow me to get the <select> value from the form and then display content specific to that value on the thank you page?

Apologies, I've got myself mixed up. Are you wanting to setup a separate thank you (redirect) page in the form settings? Drew or Rachel will have to answer that one, as it sounds like a custom PHP job (if it even is possible).

It is possible however to display different content within the <success> field based on the value of the select field (if you're using <success> instead of a separate redirect thank you page):

<perch:success>
    <perch:if id="select_id" match="eq" value="select_value_1">
        ...
    </perch:if>
    <perch:if id="select_id" match="eq" value="select_value_2">
        ...
    </perch:if>
    <perch:if id="select_id" match="eq" value="select_value_3">
        ...
    </perch:if>
</perch:success>

Thanks Philip. Yes, the aim is to deliver an Analytics script that's specific to a value of a <select> in the form. Using a <perch:if> within the <perch:success> was my initial attempt at this, but I can't seem to get any output from that at all.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You'll need to read those values in the page and then pass it into the template.