Forums

Session handling

rtobias 02 May, 2017
I'm trying to figure out how to handle using sessions for multi-form interaction. In CF5, I would use a setup along these lines:

[list]Towards the end of a Log In form, I would use the Data to Session action with a specified key.[/list]
[list]I would redirect to a page with another form, but all of my "Logged In" forms would be similar - they used the Session to Data action to check for a certain session variable that indicated if someone was logged in (usually I did this in the Load Event and used an Event Switcher to either render the form or indicate that they need to be logged in).[/list]

I know we have in CF6 Multipage and Save to Session actions. There is also Session Cart, but I don't really understand how that is supposed to work, and I didn't see any examples for multi-form setups (there is an example of multipage forms, which is more important anyway).

I know, if nothing else, I can use a php block to load session information that way, but just wanted to check if you could shed a little light on if there is an easier way to load data from session in CF6.
Max_admin 03 May, 2017
Hi Randy,

Lets say you are in form X, and you use a "Save to session" action, data provide is {data:}, function name is "session2", after this function is executed and as long as the user's session has not been terminated, you can access the data using {session:session2}, in the same form X or in another form Y.

So if one of the fields in the data array in form X was called "text1", you can then grab its value using: {session:session2.text1}

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rtobias 03 May, 2017
1 Likes
Awesome. As always, thanks a bunch Max!
rtobias 03 May, 2017
Just confirming, when you say function name, that is the name of the Save to Session action? In my case, it was defaulted to "save_to_session20". Sound about right? In my form Y, I would use {session:save_to_session20} to get all of {data:} from form X? (And if I wanted just one field, it would be {session:save_to_session20.email})
Max_admin 04 May, 2017
Hi Randy,

Yes, correct!

Best 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.