Skip to main content
1-Visitor
August 2, 2019
Solved

What exactly does 'radiogroup' in the beta radio button widget do?

  • August 2, 2019
  • 8 replies
  • 3111 views

I want to have a selection of several radio buttons. How do I use the 'radiogroup' feature to do this? For example, I just want two radio buttons, each with a label 'A' and 'B'. I have bound the radiogroup property to a service which returns two strings, but I only ever see the first one.

 

Is that what the 'radiogroup' feature will do? 

 

I have already found this article (http://support.ptc.com/help/thingworx_hc/thingworx_8_hc/en/index.html#page/ThingWorx/Help/Mashup_Builder/Widgets/RadioButtonWidgetBeta.html) and it give no real explanation. 

Best answer by PEHOWE

Hello @ague 

 

By definition a Radio button group can only have one selected option. When you provide the Radiogroup item name you are grouping the radio buttons so that the UI can update the other members of the group, when you make a selection.  In regards to the information which is returned to a service there is the state which is generally a Boolean (true/false) and the event of the stateChanged.  

 

Each radio button in a group will have a State but only one is true.

 

You can bind the state of each button to your service as an input and use the Statechanged event as the trigger to the service to process the information. 

 

If you want to allow multiple items to be selected then a CheckBox is the preferred item.

 

Hope this helps

8 replies

PEHOWE17-PeridotAnswer
17-Peridot
August 2, 2019

Hello @ague 

 

By definition a Radio button group can only have one selected option. When you provide the Radiogroup item name you are grouping the radio buttons so that the UI can update the other members of the group, when you make a selection.  In regards to the information which is returned to a service there is the state which is generally a Boolean (true/false) and the event of the stateChanged.  

 

Each radio button in a group will have a State but only one is true.

 

You can bind the state of each button to your service as an input and use the Statechanged event as the trigger to the service to process the information. 

 

If you want to allow multiple items to be selected then a CheckBox is the preferred item.

 

Hope this helps

ague1-VisitorAuthor
1-Visitor
August 20, 2019

"By definition a Radio button group can only have one selected option.

  • okay, so it can only have one selected option - fine. But can I at least get a list of radio buttons for the user to select from? Say I have a service that returned an array (for example: ['dog', 'cat', 'goldfish', 'horse']). I would like to create a radio button for each of my array items that is returned. For example, the first radio button will read 'dog', the second radio button will read 'cat', etc etc. Can I bind this service to the 'RadioGroup' property? I attempted to test this on my own and I can only ever get the first value of my array (ex: 'dog') to show. Is this what you mean by 'selected' option?

"When you provide the Radiogroup item name you are grouping the radio buttons so that the UI can update the other members of the group, when you make a selection."

  • okay, so does this really mean that the RadioGroup feature is really just for naming a group of radio buttons and nothing more? Like I could dynamically name my group 'Pets' but I couldn't dynamically set the options of radio buttons for the user to choose from? What's the point of that?

 

16-Pearl
August 20, 2019

RadioGroup is a means to say, these radio buttons belong to one group(say Pets) and only one option should be allowed to be chosen from these, at a time.