I would like to use checkbox as a template in vision and it will be repeated as per the selection in a radio button.
For eg: If i have selected 'Equipment Failure' , i should be able to select only one option from subcategory which is a repeater.
Currently multiple selection is possible which i would like to restrict.
Any ideas to achieve this?
Radio buttons are tied to each other if they're in the same container. Because yours are all container in their own template, they are all independent. I don't think you'll be able to use the default functionality, you will probably need to read the current state into your radio button template and fire a script to deselect the buttons that aren't on
You're running into a fundamental radio button behavior. The template acts as a container, so without another radio button in the template, the setSelected method is not going to work without some creative hocus pocus.
A simple way to do it would be to put a second radio button with a special name in the template with the visibility set to false, and then programmatically set the invisible radio button to setSelected(True) to deselect the visible radio button
Okay, I've tested the below script, and it works. If you name your invisible radio button: 'invisibleButton', and put the following script on the VISIBLE button's actionPerformed event handler, it will give you the result you are looking for:
rootButton = event.source.parent.getComponent('invisibleButton')
for component in event.source.parent.parent.getComponents():
for subComponent in component.getComponents():
if subComponent != rootButton and subComponent.name == 'invisibleButton':
subComponent.selected = True