0

I've got a site with six contact forms, and was hoping to be able to use a single return page for all of them and then filter the {exp:freeform:entries} data using something like Switchee (using it to examine the variable {freeform:form_name}. My freeform:entries tag has the form_name parameter populated with a pipe-separated list of all six forms, but I only seem to be getting entries from the first form displayed. Is it not possible to set up a catch-all 'Thank you' page in this way? Here's my code. First a truncated version of one of the forms (they all follow the same pattern):

{exp:freeform:form 
    form_name="new_client" 
    return="contact/thank-you/%%entry_id%%"
    }

    --- form inputs --

{/exp:freeform:form}

And then the template code on the return 'Thank you' page:

{exp:freeform:entries status="open" form_name="new_client|maintenance|payments|sales|complaints|work_with_us" limit="1"}
    <p>Thank you, {freeform:field:name}<br>
    You submitted contact form:</p>

    {!-- now check for which form submitted this entry --}

    {exp:switchee variable = "{freeform:form_name}" parse="inward"}
        {case value="new_client|complaints|work_with_us"}
            <p>NEW CLIENT, COMPLAINTS or WORK WITH US</p>
        {/case}
        {case value="maintenance"}
            <p>MAINTENANCE</p>
        {/case}
        {case value="payments|sales"}
            <p>PAYMENTS OR SALES</p>
        {/case}
    {/exp:switchee}
{/exp:freeform:entries}

No matter which form I submit from the return page shows the first entry (not even the most recent one) from the first form. I tried rearranging the order of the forms in the form_name parameter in case whichever was listed first gets used and the rest get ignored, but it makes no difference. What shows in the thank you template is the form-filler's name from the earliest form entry submitted, and Switchee uses the first case. the entry ID appended to the URL seems to do nothing. What's the correct way to set this up?

1 Answer 1

1

I would try specifying the entry id in freeform entries tag. This would ensure that you are getting the correct entry in those tags

1
  • The problem, I discovered, is that the entry_id for a form submission is unique only to that particular form, not across all Freeform forms. So each of my six forms can have an entry with entry_id="1". So, Johnathan, I did implement your idea but I still had to create a separate thank-you template for each form. To use a single template I'd need to pass the form name to the thank-you template. I suppose a hidden field in the form might achieve that. Maybe something I'll revisit at a later date. For now it's working, albeit with multiple templates.
    – RickL
    Feb 14, 2015 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.