use data from prev pages for conditional display in a multi-page form

studiocardo 12 Jan, 2017
Gents

I have a length multi-page form that I would like to use data from previous page to conditionally display the customized questions, based on the value of the data, to the users. For example, on page 2, I have a radio input that prompts the user for gender, eg.

<div class="uk-form-row">
<label class="uk-form-label">Gender:</label>
<div class="uk-form-controls uk-form-controls-text">
<input type="radio" id="gender_male" name="data-gender" value="male">
<label for="gender_male"> Male </label>
<input type="radio" id="gender_female" name="data-gender" value="female" >
<label for="gender_female"> Female </label>
</div>
</div>

On page 5, I would like to use the value of data-gender to display the appropriate reproductive systems by doing:

<div rel="gender" data-gender="female">
...
</div>
<div rel="gender" data-gender="male">
...
</div>

So only the targeted div will be displayed, depending on the value of "data-gender".

What is the best to do? I am aware of "data-to-session" and then "session-to-data". Is that the best way to achieve this? So do I just add data-to-session to Page 2 and then session-to-data on Page 5?

Thank you for your input. Much appreciated.

SH
GreyHead 13 Jan, 2017
Hi studiocardo,

There's a Multipage action that combines the two Session/Data actions and should do what you need. You will need to add code specifically to show/hide the parts you want. This can be done from the Designer/Events tab or using PHP+CSS or just PHP in custom containers depending on what you need to show/hide.

Bob
studiocardo 23 Jan, 2017
Thanks Bob, that works!

So I instantiated data-to-session on page 2 and then session-to-date on page 10. Both actions share the same session key.

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

VPS & Email Hosting 20% discount
hostinger