How can I clear the form when it relaods?
Published: Sunday, 01 March 2015 13:14
The question came from a user who was building a form to create a series of entries. They wanted to re-load the form after it was submitted to add another set of entries. By default ChronoForms v5 re-loads the form and displays the last set of entries. Here are two possible solutions.
Using a Redirect action
You can use a ReDirect action from the Utilities Group at the end of the On Submit event and set the URL to
Using Custom Code and an Event Loop
You can add a Custom Code action with this code in it followed by an Event Loop action pointing back to the On Load event (that's the default setting):
$form->data = array();
Either method works - the ReDirect is simpler, the Custom Code allows more flexibility should you need it - for example you could unset only some of the data values in the $form->data array and leave others.