Unable to get the selected Value through choice RadioGroup

5 messages - 84 views

Hi All !

I am using several choiceRadioGroups in this similar way

<choice >
  <choiceRadiogroup id="chGroup1" >

     <radiobutton selected="true" >1</radiobutton>
     <radiobutton>2</radiobutton>
     <radiobutton>3</radiobutton>
    
  </choiceRadiogroup>
</choice>

<button onAction "action(#chGoup1.selected)" >%ACTION%</button>

and willing to get the selected value of the choice group on the button Action in context of chGroup1. Can any body help me out to identify the problem ?

Thanks !

 

You need to use the value attribute instead of th selected attribute. It will returns the selected radiobutton value.

...

<button onAction "action(#chGoup1.value)" >%ACTION%</button>

Hi Tofu !

     Thanks For Reply,  I have already tried out Value attribute too , But Unable to get this selected value 1, 2 0r 3 through

<choice >
  <choiceRadiogroup id="chGroup1" >

     <radiobutton selected="true" >1</radiobutton>
     <radiobutton>2</radiobutton>
     <radiobutton>3</radiobutton>
    
  </choiceRadiogroup>
</choice

<button onAction "action(#chGoup1.value)" >%ACTION%</button>

in my Frame.

String ComboValue= (String) arguments[0];

Is there some thing which , I am missing still ? presently , it's Giving me null ..

 

Ho, yes, I forgot to say that you have miss the value attribute on each radioButton. You need to understand that the 1, 2 or 3 placed into radioButton tags aren't a value, but it's only a text widget, and it coulds be any widget like picture for example.

You need to have :

<choice >
  <choiceRadiogroup id="chGroup1" >

     <radiobutton value="1" selected="true">1</radiobutton>
     <radiobutton value="2">2</radiobutton>
     <radiobutton value="3">3</radiobutton>
    
  </choiceRadiogroup>
</choice>

<button onAction "action(#chGoup1.value)" >%ACTION%</button>

Else, you can replace the selected="true" on the first radioButton by the value="1" attribute in choiceRadioGroup tag.

Thanks Tofu !

     Me too have resolve the issue ..  Thanks For this Quick Risponse ..