Forums

How to clear form data after submission

rlab 17 Feb, 2014
Hi,

I have a multiple page form. The user goes through the pages entering his information and then submits the form. But when you go back to the start of the form again, the data that the user submitted is still there, it hasn't been cleared out and the default values added back, for the next person to enter their information.

Basically this is a prize draw form, that is being used at a trade show. So, the same form is used over and over again, but by different people. I need a way to clear the form values after the form has been submitted. Is there a way to do that in chronoforms in the On Submit event, after the form data has been saved in the database and the emails with the information sent?

If I can't do it in Chronoforms form, is it possible to put something in the Thank you page that the user gets redirected to after they have finished submitting the form. Is there a way to clear the form data/user session information so the next person going to the form will get default values again?

I tried adding the following to the thank you page:

$session = JFactory::getSession(); $tmpUser = $session->get('user'); $tmpUser->cf_datafields = 0; $session->set('user', $tmpUser);

cf_datafields is the unique session key I added in the Session to Data action.

I also tried:
$session = JFactory::getSession(); $session->clear('user');

to try to clear out all of the user's sesion data.

Is there a way to get the chronoforms form's session id to clear it?

I need to get this working for tomorrow as the trade show is starting tomorrow.

Thank you for any help on this.
rlab 17 Feb, 2014
Hi,

Followup: I found a post that said to change the last Session to Data > Clear After to Yes. Didn't help the problem.
I found a post that said add a Custom Code action before the redirect with the following:
<?php
unset($form->data);
?>

Again didn`t make any difference.
rlab 17 Feb, 2014
This doesn't seem to be a browser cache issue, because if you set the Joomla session variable down to say 1 minute, then the fields get cleared if you wait a minute between submissions.
GreyHead 17 Feb, 2014
Hi rlab,

The solutions you've tried are what I would suggest. Please try adding a Debugger action at the beginning of the On Load event of the form so that you ca see if data is being re-loaded.

You could also try turning off the RePublisher in the Show HTML action, that should also help.

Bob
Max_admin 19 Feb, 2014
Hi,

By default the data should not be available if the session key is not available in the url, did you change any configuration in the "multi page" action settings ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.