Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

get selected radio button value on form onclick

Hi All,

    I have a three radio button which is in form. I want to get the selected radio button values while submit a form. How to do this? I have mentioned my code below. Any help would be greatly appreciated.

var oform = new sap.ui.layout.form.SimpleForm("f1",{

  maxContainerCols:4,

  editable:true,

  content:[

          new sap.ui.commons.RadioButtonGroup({

          columns:4,

          items:[new sap.ui.core.Item({text:"radio1"}),

                 new sap.ui.core.Item({text:"radio2"}),

                 new sap.ui.core.Item({text:"radio3"})

                 ]

          }),

          new sap.ui.commons.Button("b1",{

          text:"Submit",

          width:"100px",

          press:function(){         

          var selItem = sap.ui.core.Item.getSelectedItem(); // Need to get selected radio button values

         

          }

          })

          ]

  });

  oform.placeAt("content");

Tags:
Former Member
Former Member replied

if you want to get text,

oRBG2.getSelectedItem().getText());

2nd example of this link RadioButtonGroup - SAPUI5 Demo Kit

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question