Flex ; get the value of RadioButton inside a FormItem
- by numediaweb
Hi,
I'm working on Flash Builder with latest flex SDK.
I have a problem getting the value radioButton of the selceted radio button inside a form:
<mx:Form id="form_new_contribution">
<mx:FormItem label="Contribution type" includeIn="project_contributions">
<mx:RadioButtonGroup id="myG" enabled="true" />
<mx:RadioButton id="subtitle" label="subtitle" groupName="{myG}" value="subtitle"/>
<mx:RadioButton id="note" label="notes / chapters" groupName="{myG}" value="note"/>
</mx:FormItem>
</mx:Form>
the function is:
protected function button_add_new_clickHandler(event:MouseEvent):void{
Alert.show(myG.selectedValue.toString());
}
I tried also:
Alert.show(myG.selection.toString());
bothe codes show error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
and if It only works if I put :
Alert.show(myG.toString());
it alerts : Object RadioButtonGroup
thanx for any hints, and sorry for the long message :)