How do I get a radio button to set value for variable?

Michael Magoon shared this question 7 years ago
Answered

I am a new user, so I may be missing something obvious, but I cannot figure out how to set the value of a variable using the user-selection of a radio button. I am using the "Radio List" widget. I want to drag the radio button option from the Workspace over to the Variables list, but I can't select an individual option.

Comments (4)

photo
1

If you drag a 'Radio list' to a variable a new event will be created. That event will store in the variable the option that is selected at that time in the Radio List when the users navigates to another screen. You can use individual radio buttons (group them to make them work as a radio list) too but then you'll have to define an 'on click - when 'is clicked' - set value true to the variable' on each.

photo
1

I think that is pretty much what I did. I dragged a Radio list with two options to the Variable. It created a Page Unload event as you said. Is the value being stored, the actual text in the Label for the Radio List? Or is it just storing a binary value that the radio button was selected?


Is there a way for me to check what value is actually being stored in my simulation? It is possible that the problem is with the Condition that is using the value in the variable. It looks correct, but it may not be. I basically entered =


I seem to remember from the documentation that if I drag a Variable into the Workspace, it will display the value in the Simulation, but I cannot seem to get that to work.

photo
1

The value that is stored is the actual text in the label for the selected radio. To know which value has been stored in the variable you must compare with the text. For instance if you have a radio list with these options: 'value 1', 'value 2', 'value 3', then the condition must be when((variable = value 1)). To build this condition you have to drag the 'equals' function. Then in the first hole drag the variable and then double-click in the second one and write value 1.

photo
1

This doesn't seem to be a full response as it doesn't explain what to do about the other values and I am trying to do the same thing I think?


I have two scenarios I am dealing with:


1) I have a form on a screen which includes a radio list with options "option 1", "option 2", "option 3" on one screen with a button which says 'submit' which takes me to a screen of responses.


On the responses screen I have a label which says "Which option?" and another label which I believe should be showing the selected response from the radio list but all it is showing is a blank field


2) I have a form but this time I have used individual radio buttons and grouped them as I want them displayed horizontally not vertically and again I would like to show the chosen value on another screen


Is it possible to help me out with the steps to do this please? I am using the latest version 6.0


Thanks ......