2

I am redirecting a user to a custom template after they submit a form. I'd like to include their name on the thank you page, but as it's a redirect, I can't get any form data.

I tried editing this line on mod.forms.php

$form['return'] = $form['form_settings']['return_url'];

To

$form['return'] = '/mytmeplategroup/thankyou/' . ee()->input->post('name_first');

But as the return URL is generated BEFORE the form is submitted, this is clearly the wrong answer.

Can I pass custom variables to a new template (worst case, just a form submission entry Id and I can go get the data perhaps?)

2

You can use use a variable in your return url like this:

return="/mytmeplategroup/thankyou/%FENTRY_ID%/"

And on the thankyou template do something like this:

{exp:forms:entries fentry_id="{segment_3}"}

| improve this answer | |
1

I dunno what Forms is doing with return_url, but could you do something with JavaScript in the generated form's onsubmit event?

| improve this answer | |
  • Need a non JS solution sadly.. I ended up 'hacking' the module.. added a hidden field on the form page too.. using that to set a session and pick up the data elsewhere... phew! – Beertastic Aug 28 '13 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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