Hello,
I have a multi-page form which on page 1 asks for selection data, and on page 2 displays the result in a summary table.
I want page 3 to display details of a selection from this summary table.
However the array data I retrieved in a php action on page 2 is not visible in page 3. I placed the array in a hidden field, so I expect ed that the array would be visible in the page 3 context.
Also,I did not see how I could return the data in a var at the end of the php action. I am sure this is covered somewhere in the documentation but I did not find it anywhere.
Cheers
Tim
I have a multi-page form which on page 1 asks for selection data, and on page 2 displays the result in a summary table.
I want page 3 to display details of a selection from this summary table.
However the array data I retrieved in a php action on page 2 is not visible in page 3. I placed the array in a hidden field, so I expect ed that the array would be visible in the page 3 context.
Also,I did not see how I could return the data in a var at the end of the php action. I am sure this is covered somewhere in the documentation but I did not find it anywhere.
Cheers
Tim
Hi Tim,
I'm not sure that you can add an array as a value to a hidden input. You could json_encode it to convert it to a string or add the value to the User session and recover it form there.
Please see page 34 of the manual for getting values returned from a PHP action.
Bob
I'm not sure that you can add an array as a value to a hidden input. You could json_encode it to convert it to a string or add the value to the User session and recover it form there.
Please see page 34 of the manual for getting values returned from a PHP action.
Bob
Hi Bob,
I can now retrieve the data I need from the API in Page 2 and store it in a $this->data['result'] array and/or return it as a var from the php action. No worries there, all the data appears in a debugger on Page 2.
However, my process is that I then (in page 2) display a summary of the retrieved records to the user and ask them to choose one from this table, so that I can display full information for one record only in Page 3.
The problem is that when I get to Page 3, the data retrieved from the API in Page 2 isn't there. The $this->data['result'] field is visible in the debugger but it is empty. The other user entered fields are present, so I can repeat the API query in page 3, but this is not efficient. I tried manipulating the Mix multipage data with global data checkbox, but this made no difference.
A related question: I am also unsure as to what syntax I should use in php to access a shortcode, so to do something like:
Cheers
Tim
I can now retrieve the data I need from the API in Page 2 and store it in a $this->data['result'] array and/or return it as a var from the php action. No worries there, all the data appears in a debugger on Page 2.
However, my process is that I then (in page 2) display a summary of the retrieved records to the user and ask them to choose one from this table, so that I can display full information for one record only in Page 3.
The problem is that when I get to Page 3, the data retrieved from the API in Page 2 isn't there. The $this->data['result'] field is visible in the debugger but it is empty. The other user entered fields are present, so I can repeat the API query in page 3, but this is not efficient. I tried manipulating the Mix multipage data with global data checkbox, but this made no difference.
A related question: I am also unsure as to what syntax I should use in php to access a shortcode, so to do something like:
$name = {data:lastname};Obviously this won't work, but what will? Must it be something like:
$name = echo '{data:lastname}';
Cheers
Tim
To access data in PHP:
For {data:variable}
For {var:variable}
If you want something to be saved to session using multipage, then you need to have a multipage action in the submit event. Then on your summary page you can use multipage with it set to mix with global data. Or you can use a save to session action, and retrieve the value later with {session:variable}
For {data:variable}
$this->data("variable", "default value if not found");
For {var:variable}
$this->get("variable", "default if not found");This can be found in the shortcodes FAQ, the instructions, and a hundred posts on the forums.
If you want something to be saved to session using multipage, then you need to have a multipage action in the submit event. Then on your summary page you can use multipage with it set to mix with global data. Or you can use a save to session action, and retrieve the value later with {session:variable}
Thank you, and my apologies for missing this. I had read it of course, just slipped past me at the time. Is there a similar syntax for retrieving the {session:variable}?
Thanks again for all the help.
Tim
Thanks again for all the help.
Tim
Dont think so just use standard PHP syntax.
This topic is locked and no more replies can be posted.