redirect back to the same form with confimation/thank you message on top upon submit

redirect back to the same form with a confirmation message upon submit.

Overview

The form redirects to a separate thank you page instead of showing the message on the same form.
Add a Custom Code action after On Submit to clear form data and set a reload trigger. Then, place a Custom Code element at the top of the form to display the thank you message only when the reload trigger is detected.

Answered
Wh WhiteLighter01 09 Sep, 2016
Hi all,

After being away from web development for a couple of years, I'm back.

What I need to do is, after submit, is to display the thank you/confirmation message at the top of the form and clear the form of any values entered, instead of showing a thank you/confirmation page. How should I approach this?

Thanks in advance for all the help/guidance ^_^
Gr GreyHead 14 Sep, 2016
Answer
Hi WhiteLighter01,

Here's one way to do this.

At the end of the On Submit action add a Custom Code action that a. unsets the form data and b. sets a trigger value to say this is a reload.
<?php
unset($form->data);
$form->data['reload'] = 1;
?>


In the Designer tab add a Custom Code element at the top of the form that will show the Thank you message only if reload is set:
<?php
if ( !empty($form->data['reload']) ) {
  echo '<p>Some thanks message</p>';
}
?>

Bob

Bob
This topic is locked and no more replies can be posted.