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

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 ^_^
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.