Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
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.
Solved! Go to Solution.
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
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
"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."
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.
One possible way to achieve your requirement would be to have a thing with properties as let's say pet1,pet2 etc with string values as Cat, Dog etc. In mashup, you could add GetPropertyValues service and from the returned data bind pet1, pet2 etc to corresponding radio buttons. When you want to change the labels you may update the property values.
"In mashup, you could add GetPropertyValues service and from the returned data bind pet1, pet2 etc to corresponding radio buttons."
It seems like a drop down list would be better suited for your use there. In typical UX (not specific to ThingWorx), radio button groups are not dynamically created from data sets.
Hello @ague ,
You are trying to get information from a radio button which is not the information it was designed to return. In regard to your questions:
For each radio button in a group you can test its value and determine if it was selected. Each Radio button returns a selected or not selected value. I believe you are expecting the radio button or group of radio buttons to return the name/value of the one which is selected.
That is not how it was designed to work.
If you are working with a dynamic entries a drop down list would be a better choice. Multi selection is supported for a drop down item.
Thank you for the clarification!