I have a standard form (with textareas, date controls, checkboxes, etc), and I'm trying to recursively drill into it to visit all the fields and determine their id and textual value. I am successfully seeing all the controls, except for the RadioButtonGroup. For example, when I use the following mxml for the form:
<mx:FormItem id="litFormItem" label="Is there any litigation involved?" width="300" horizontalAlign="right">
<mx:RadioButtonGroup id="litInvolved" enabled="true" />
<mx:RadioButton id="litInvolvedYes" value="1" label="Yes" groupName="litInvolved"/>
<mx:RadioButton id="litInvolvedNo" value="0" label="No" groupName="litInvolved"/>
The recursive code visits the grid item, sees one child (the form item), then visits the form item, but here it only sees 2 children (the 2 radio buttons)... it doesn't see 3 children, which I would expect.
Therefore, I am unable to access the radiobuttongroup in order to access the "selectedValue" property which would give me a 1 if they clicked the Yes radio button, and a 0 if they clicked the No radio button.
If I use the debugger, stop at the level of the form item, and look at its properties, I see a property named $numChildren, which is set to 3, but I also see a property named numChildren (with no dollar sign) which is set to 2. This is another thing that is confusing...
Any help is appreciated... Thank you.
The RadioButtonGroup is not an actual visual child, or a DOM accessible component per say. It's really only an abstract grouping declared within the context of your document. Give it an id and you can of course access the RadioGroupInstance at runtime via the id but it's not a display object.
Thanks... it's frustrating that the DOM structure does not include the RadioButtonGroups...
I ended up "visiting" the radio buttons, which happen to have a "group" property, so I can then come backwards from the radio button to ask the group what the selectedValue is. Unfortunately with this method, I end up visiting all the radio buttons within a single group, which is unnecessary, because they each report back the same group, and thus the same selectedValue. To work around this, I kept track of all the RadioButtonGroup names that I visited, and thus would skip the processing if I had already obtained the selectedValue for a particular group.