Stephen's dev blog

Posts Tagged ‘radio button

This is a pretty simple one but there are surprisingly few tutorials showing the user simply how to get a selected RadioButtonGroup’s value.

There are quite a number of tutorials covering change event triggers for RadioButton controls but this is slightly different.

Say you have a form and you want to process the RadioButton value after submitting the form instead of when the value of it changes.

To do this you actually have to create a RadioButtonGroup MXML tag for the radio buttons and select the value using the ‘selectedValue’ property of that RadioButtonGroup:

<mx:RadioButtonGroup id="myRadioButtonGroup" enabled="true" />
<mx:RadioButton label="I like RadioButtons" groupName="{myRadioButtonGroup}" left="505" top="64" selected="true" value="true"/>
<mx:RadioButton label="I don't like RadioButtons" groupName="{myRadioButtonGroup}" left="348" top="62" value="false"/>

Notice the {} around the groupName attributes of the RadioButton controls. You can then do this to select the value:

Alert.show(myRadioButtonGroup.selectedValue.toString());

Advertisements


  • Patrick: I changed my code, but now I have another problem: Fatal error: Call to a member function isAvailable() on a non-object in /var/www/vhost/web/shopA
  • Stephen Gray: Hi Patrick, That first error is my fault. I had the method name for the refund() method as void() as I had copied the code from the other method!
  • Patrick: Hi Stephen, thanks for sharing your knowledge about creating a custom payment module. I need an extension for magento to handle a credit card payme

Categories