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
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
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?
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?
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.
If you want to save all your fields to session, just use {data:} as the value.
Actually I did try {data} .. but I forgot the colon.
Anyway, all good now.
Thanks.
Anyway, all good now.
Thanks.
Also you can use {session:xxx} to retrieve your session data (but obviously not in PHP)
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.
I have already tried it but the session still sends old value.
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?
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.
Or {session.set:namegoeshere$(data:fieldnamegoeshere)}
Or use the data builder 2 action.
This topic is locked and no more replies can be posted.