Forums

Residual data problem

oneira 06 Apr, 2014
Hello:

I have a multiple page form. In the first page the user selects from a drop-down (created from a SQL consult/Custom Element) and that creates a link that allows the user to select some more info and then proceed to the next page. However, if i go back using the back arrow of the browser or after the user submits, some information is left in the first page. Also the Custom element changes from this:

<select id="province" class="" name="province" size="1">

    <option value="--"></option>
    <option value="AB"></option>

</select>


to this


<select class="" id="province" size="1" name="province">

<option value="">Please select a province</option>
<option value="">
AB  -  Alberta</option>
</select>


I tried deactivating the site cache, but it didn't work. Also tried using javascript

$('form').each(function() {this.reset()});
 window.location.reload(true);
 document.getElementById("chronoform_nomination-S").reset();


with various results, none effective.

I thought it had to do with the cf_sid variable not updating properly but i checked and it is changing with every refresh. Tried to clear the cache (ctrl+F5) but didn't work either. and also with the JAT3 Clean Cache plugin.

The form itself is working fine except for that not so little problem. Thanks
GreyHead 07 Apr, 2014
Hi oneira,

I'm not sure why your custom code is breaking but it may be because you are using -- as a value or because there is no text in the options.

You should also check that you have a Session to Data action with Clear Data set to yes in the final form event.

Bob
oneira 07 Apr, 2014
Well i checked and the changes are made automatically. That is, the first time i load the form it shows me the first code

<select id="province" class="" name="province" size="1">

    <option value="--"></option>
    <option value="AB"></option>

</select>


Which is working fine, and as i said, is generated in a Custom Element from a SQL query. However if i go to the second page and then go back using the browser back arrow, It will show the second code

<select class="" id="province" size="1" name="province">
<option value="">Please select a province</option>
<option value="">
AB  -  Alberta</option>
</select>


And as far as i know, that is not being generated from a Custom Element but probably from a cache file, or something. As i said before, i've tried every option to clean the cache but to no avail.

I followed the tutorial provided here
http://www.chronoengine.com/faqs/57-cfv4/cfv4-actions/2658-how-can-i-create-a-multi-page-form.html


and in my current list of events i dont have a Session to data, although the problem is not when the user submits the form but when he/she reloads the first page.

Thanks
oneira 07 Apr, 2014
Update: i found a post that suggested using this code

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


and it's kind of working.

I have tested the following scenarios:
Scenario 1
1. the user access the form
2. selects and goes to page 2
3. goes back to page 1 using the navigation buttons on the browser
4. selects another value and goes to page 2

Scenario 2:
1. the user access the form
2. selects and goes to page 2
3. goes back to page 1 using the navigation buttons on the browser
4. reloads the page

The scenario 1 is working and the scenario 2 is not. I tried using the Session to Data but it didn't work.

Thanks
GreyHead 10 Apr, 2014
Hi oneira,

Sorry, I have no idea what is happening here. What you describe doesn't make sense to me :-(

Bob
oneira 10 Apr, 2014
i think i made it work.
i used this code
$app = JFactory::getApplication('site',array('session'=>false));
unset($form->data);
$session = JFactory::getSession();
$session->clear('user');


as suggested in this post and it worked!

However, I'm not exactly sure what happened, because the two lines do two different things: one clears the Joomla Session for the guest user, and the second one unsets the values. So, i would kindly suggests that you guys check this one out so it can be labeled as a bug, glitch, or simply config error. Thanks
GreyHead 11 Apr, 2014
Hi oneira,

I still have no idea what the problem is that you have solved :-( Hard to know if there is any bug or not - I rather think not.

Be careful clearing the User session as that will affect the whole Joomla! session, not just ChronoForms.

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