Forums

Confirm Page CF5. How do I pass data back to the initial form.?

NickOg 25 Apr, 2015
I know I should be able to do this and have done so in the past.

I used the demo multipage as a starting point. All goes well - data entry, confirmation page, post the confirmed data. But I can't get the data passed back to the initial form when I select a back button. I see from one of Bob's posts that session to Data/Data to Session is not necessary in multipage forms and that works fine.

But do I need data to session on the confirm page and then session to data on load? I have tried that but nbg.

copy of form backup attached if that helps.

stuck!๐Ÿ˜ถ

Nick
GreyHead 25 Apr, 2015
Hi Nick,

There is no attachment - you have to upload the file before submitting the post.

If you have a multi-page action on each of the pages - including the first then all should work OK.

There is a potential problem if the form can be used more than once in the same session as the previous data will re-load, if that is a problem then you can clear it on the final submit event.

Bob
NickOg 25 Apr, 2015
Doh!

Here it is Bob. I have checked it again and i can't see the problem. I will send you details to access the form if you need to and have time.


Regards

Nick
NickOg 26 Apr, 2015
I am not sure how but I seem to have solved this. I mistakenly deleted the submit, rest and back buttons in their container. Once I reconstructed the set all seems to have been sorted. That may be a coincidence and something else fixed it. Wish I was sure
NickOg 01 Nov, 2015
Hi Bob

I was sure I had this fixed but no good. A new form wouldn't work and checking the old form - it no longer works - except maybe in Chrome!.

Back to the beginning! I have modified the multi-page demo form - changed the button text - and added a few back buttons. A copy is attached. But stuck! It just does not work. When I go back the previous data does not appear.

Can you tell me what i am doing wrong? I am using history.back() - I assume that it the correct approach.

๐Ÿคจ

Nick
GreyHead 02 Nov, 2015
Hi Nick,

The main problem is that the Multi-Page action in the On Load event is set to clear the data so it will always show an empty form. Change Reset Data to No.

If having this set to No is s problem then you can use an Event Switcher, or Custom Code to check if this is a redirection or a fresh form load by adding a parameter to the 'back' url like &reload=true.

I would not use the JavaScript history but set a specific URL for the form and event.
<a href='index.php?option=com_chronoforms5&chronoform=demo-multipageWithBack&event=load'>
It will probably look better if you use a Custom Code element to build the button row rather than nested containers.

Bob
NickOg 02 Nov, 2015
Many thanks Bob. Setting 'Reset Data' to 'No' does cause problems. Your suggested solution works fine.

I included an event switcher On Load with separate Mutliforms with and without reload as you suggest. Works a treat.

As to the button in a container - there was an excellent reason why I did that but I can't for the life of me remember what that was.๐Ÿ™„ I will pick up your suggested approach.

Nick
NickOg 04 Nov, 2015
Still struggling with this Bob.

The attached form certainly works in terms of either loading or reloading the form! I have attached a pdf with these notes and screen shots.

But in words though
[list=]Check odd number check boxes, Check the Form and it works fine[/list]
[list=]Edit and check the even number check boxes as well, Check the form and then edit the data and it works fine[/list]
[list=]Edit an uncheck the even number check boxes. Check the form and then edit the data. Now all of the odd boxes are checked - 1,3,5,7,9 but 6,7,8 & 9 as well![/list]

I am clearly missing something. Can you help with this - again - please?๐Ÿ˜ถ

Regards

Nick
GreyHead 04 Nov, 2015
Answer
Hi Nick,

There is a 'quirk' in the way that the Multi-Page action handles data - I think that it is a bug, Max has it as a feature. Either way it occasionally bites. You can get round it by using the Session to Data and Data to Session actions (the Multi-Page action is a wrapper for these).

In the On Load event replace the Multi Page actions with Session to Data actions. Set the On Load one to Clear session: Yes and the On ReLoad one to Clear session: No

In the On Submit event replace the MultiPage action with a Session to Data action with Clear Session: No and Overwrite Old data: Yes

In the Page 2 event replace the Multi Page action with a Data to Session action and set Merge Data to Yes.

This combination of settings appears to work correctly to stop the effect of 'sticky' checkboxes.

See my test here

Bob
NickOg 05 Nov, 2015
Thanks Bob - that looks like it.

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