Radio Button Form Validation:
<Label text="Sex" />
<HBox >
<RadioButton groupName="sex" id="gender_male" text="Male" />
<RadioButton groupName="sex" id="gender_female" text="Female" />
</HBox>
<HBox >
<RadioButton groupName="sex" id="gender_male" text="Male" />
<RadioButton groupName="sex" id="gender_female" text="Female" />
</HBox>
var male = this.getView().byId("gender_male").getSelected();
var female = this.getView().byId("gender_female").getSelected();
if(male!=true && female!=true){
sap.m.MessageBox.alert("please select your gender");
return false;
}
var female = this.getView().byId("gender_female").getSelected();
if(male!=true && female!=true){
sap.m.MessageBox.alert("please select your gender");
return false;
}
Note:
getSelected() method will take selected radio
It's usefule for me. Kindly post the same like how to reset the radiobutton value
ReplyDelete