justinmind-logo
 
Upvote 1

Change Values in Selection Component

In Progress jgd 4 years ago

Can I modify the values of a selection component based on a previous value? How?


We have a radio-list selection component (RL1). Based on the selected value we have to change the available options in another radio-list selection (RL2) of the next page....


Let´s say in RL1 we have Opt1, Opt2 and Op3. In RL2 we have A, B and C. Then:

  • If you select in RL1 Opt1, in RL2 it shows A and B.
  • If you select in RL1 Op2, in RL2 it shows A and C.
  • If you select in RL1 Opt3, in RL2 it shows B and C.

Thanks in advance.

Replies (3)
photo
1

Yes, here's how:

1. Create a Variable and leave its default value blank (look to the Variables palette and click the '+' icon. If you don't see the Palette, look to the View menu to show it).

2. With the RL1 selected, create an "On Change" + "Set Value" event, setting value to the Variable.

For the value, click the 'Calculated' radio button, and then 'Add expression'. You'll see the Calculated Expression builder pop up. Drag RL1 into the open space where it says 'Double click to edit or drag & drop a component). Then click 'OK'.

3. On the next screen (with RL2) create an "On Page Load" + "Set Value" event, setting value to RL2. For the value, add 'A' and 'B' and click 'Ok'.

4. Look to the Events palette, where you'll see the event you just created. Click the 'Add condition' text, which will open the Conditional Expression builder. Drag the Variable to the open space in the expression, and an '=' function next to it. In the open space that appears, type 'Opt1'. Note that this text must match exactly a value in RL1. Click 'Ok'.

5. Back in the Events palette again, click the 'Else' text and create another "On Page Load" + "Set Value" event, setting value to RL2. For the value, add 'A' and 'C' and click 'Ok'. Add a condition to this text, which is the same as the last one, just changing the text you type in the end to say 'Opt2' instead.

6. Add one last "On Page Load" + "Set Value". Add 'B' and 'C' as values and click 'Ok'. There's no need to create a condition for this text.

I've also attached an example file. Hope this helps and let me know if you have any questions!

photo
1

Thanks !!


It works nicely... but I have another issue. The radio-list has horizontal orientation as default in properties panel, but when I change the values of the radio-list (based on previous variable value), the radio-list changes to vertical orientation.

How can I get horizontal orientation then?


Thanks in advance.


Regards.

photo
1

This looks like a bug! I'll send this to our team. As a workaround, instead of using a Radio List widget, group together two texts and two radio buttons on the Canvas in a horizontal position.

Then, modify the "On Page Load" event and have it set value to a text field instead of the Radio List. You'll need two actions now - each one setting the value to one text field.

Leave a Comment
 
Attach a file