Wednesday 1 April 2015

Radio Button Form Validation

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>

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;
        }

Note:
getSelected() method will take selected radio

1 comment:

  1. It's usefule for me. Kindly post the same like how to reset the radiobutton value

    ReplyDelete