Nov 1st, 2009, 11:12 PM
Dear Ben,
It will be good if you can add this to FT2. Let the program return a sucess code on successful completion.
Thanks.
It will be good if you can add this to FT2. Let the program return a sucess code on successful completion.
Thanks.
(Sep 21st, 2009, 8:08 PM)Ben Wrote: Hi Ryan,
Interesting problem! Yes, with the built-in processing functions - process.php & the API - you'll get automatically redirected, so you're rather stuck there...
Adding another "special" hidden field to let the process.php script know not to redirect would seem to be the simplest solution from a code point of view, but then that opens up the question about success and error messages. To be really solid, it should output all error messages - not just the success message - and that would be a big undertaking.
Hmm...! I must say, I don't have any terribly brilliant ideas... rats.
That said, I'm not averse to adding in this functionality to the existing code - it may not be the most elegant thing ever, but it will at least solve your case - and other similar situations that people run into. So just do this: on line 323 of process.php, you'll see this:
PHP Code:if (!empty($form_info["redirect_url"]) || !empty($form_data["form_tools_redirect_url"]))
change it to this:
PHP Code:if (isset($form_info["form_tools_no_redirect_success_message"]))
{
echo $form_info["form_tools_no_redirect_success_message"];
exit;
}
else if (!empty($form_info["redirect_url"]) || !empty($form_data["form_tools_redirect_url"]))
Then, add a new hidden field to your form:
Code:<input type="hidden" name="form_tools_no_redirect_success_message" value="Congrats your form was submitted" />
That should then work as you described. If this works for you, I'll include it in the next release so you can upgrade in safety.
Sorry I don't have any better solutions for you!
- Ben