I have found that the session data for a multipage form is cleared if you complete the form without any redirects, so that if a user starts the form again the fields are all empty or at their defaults. However, if you do a redirect at the end of the last page submission the session data is not cleared so that if a user restarts the form the previous form field values are displayed.
I tried using a variables action setting individual session variables to null but that did not work for me.
However, with some debugging I found a bit of PHP that does this for me. The below example enqueues a "form completed" message and clears the session data for the form prior to a redirect action.
JFactory::getApplication()->enqueueMessage('Craft booked, do not forget to pay', 'info');
$session = Joomla\CMS\Session\Session::getInstance();
$session->clear("chronoforms8_data_1");
I want to check if there is a proper or better way of doing this in CF8?
Hi Craig
Thanks for posting about this, your code is ok but it will not clear all the session data, and the code will have to be changed based on the form, I have added a new setting to the Redirect action to do just that: