Flex ; get the value of RadioButton inside a FormItem

Posted by numediaweb on Stack Overflow See other posts from Stack Overflow or by numediaweb
Published on 2010-05-13T16:39:17Z Indexed on 2010/05/13 16:44 UTC
Read the original article Hit count: 314

Filed under:
|
|
|
|

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 :)

© Stack Overflow or respective owner

Related posts about flex

Related posts about flash