cancel
Showing results for 
Search instead for 
Did you mean: 

how to get a radiobutton Id from radiobutton group.

0 Kudos

I want to show different chart on click of radio button as of now. I have a radiobutton group. How did is fetch particular radiobutton. for example.

view::

<RadioButtonGroup id="RID" select="onSelect_Radiobutton" columns="3">

  <buttons>

  <RadioButton text="Domestic" id="Domestic" selected="true"

  />

  <RadioButton text="Commertial" id="Commertial"  />

  <RadioButton text="Industrial" id="Industrial"  />

  </buttons>

  </RadioButtonGroup>

Controller:

onSelect_Radiobutton : function(evt) {

  

if( ---"some code to fetch and evaluate which radiobutton"---)

{

  var op3 = this.getView().byId("idPanel");

  op3.removeAllContent();

  op3.addContent(oVizFrame).addContent(oPopOver);

}

ifelse(){}.... continue

  },

.....................................

How to perform "some code to fetch and evaluate which radiobutton".

Accepted Solutions (1)

Accepted Solutions (1)

former_member221786
Active Participant

One Possibility:


var whichBtn = evt.getSource().getSelectedButton();


and then


whichBtn.getText() == "Commertial"

Answers (1)

Answers (1)

Abdul_Waheed
Contributor
0 Kudos

One more Possibility:


<RadioButtonGroup id="RID" columns="3">

  <buttons>

    <RadioButton text="Domestic" id="Domestic" selected="true" select="onSelect_Radiobutton"/>

    <RadioButton text="Commertial" id="Commertial"  select="onSelect_Radiobutton"/>

    <RadioButton text="Industrial" id="Industrial"  select="onSelect_Radiobutton"/>

  </buttons>

</RadioButtonGroup>

Controller:

onSelect_Radiobutton : function(evt) {

var _radioButtonID = evt.getParameter("id");

}

0 Kudos

This option will get the id. However, the id will be prepended with some extra characters.