Buy Now
Sign in

Using Data Builder Action to save/retrieve session data

tshirley , June 05 2019, 03:42
T
tshirley 290
June 05 2019, 03:42 #387281
Hi,
I understand that the Data Builder action is now used to save session data.
So I placed a Data Builder Action, and in the Value section selected "Session" and gave a name "ss". Put nothing in the value field.
Then in the page where I wanted the session data back, I placed
$sessiondata = \GApp::session()->get("ss", "");
which used to work, and still does in forms which are still using the old style.
But now it is empty - no data is returned.
What am I doing wrong?
Cheers
Tim
T
tshirley 290
June 05 2019, 08:32 #387285
I have found the answer, so no need for a response.
In the Data builder the "value" field needs to reference the data to be saved. so, in the value field place {data:somefield} or {var:somevar}.
The the retrieval code
$sessiondata = \GApp::session()->get("ss", "");
recovers the data as required.
I wonder if there is a shortcode that will save the entire session data?
healyhatman 8
June 05 2019, 08:58 #387287
 Answer
If you put nothing in the value field, what were you expecting to get back?
If you want to save all your fields to session, just use {data:} as the value.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
T
tshirley 290
June 05 2019, 09:01 #387288
Actually I did try {data} .. but I forgot the colon.
Anyway, all good now.
Thanks.
healyhatman 8
June 05 2019, 09:05 #387289
Also you can use {session:xxx} to retrieve your session data (but obviously not in PHP)
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
S
saveg 90
December 20 2019, 14:50 #390452
Hello again, just wanted to double check if you meant by {session:xxx} to be inserted into action as a custom code or what exactly.
I have already tried it but the session still sends old value.
S
saveg 90
December 20 2019, 19:46 #390454
in a nutshell I dont want to retrieve the data only , but I want actually to set the prev session data into the current session. is this possible at all?
healyhatman 8
December 21 2019, 07:47 #390456
 1
Yes I meant in Custom Code action, or wherever you want to use it (like the save data action), just not in PHP. {session:namegoeshere} will retrieve the session, {session.set:namegoeshere$valuegoeshere} sets it.
Or {session.set:namegoeshere$(data:fieldnamegoeshere)}
Or use the data builder 2 action.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
S
saveg 90
December 24 2019, 06:46 #390469
thanks alot for clarification