Wednesday 1 April 2015

Mobile Number Validation in Form in SAP UI5

Phone Number Validation:

<Label text="Phone" />
          <Input value="" id="phone" maxLength="10"></Input>


var no =this.getView().byId("phone").getValue();
    if(no ==""){
        sap.m.MessageBox.alert("Please write your Phone Number");
        return false;
    }
    else if(isNaN(no) || no.length === 10){
        alert(" enter valid number");
        return false;
    }

Note -  "isNaN(no)" for not to take characters in Input
             "no.length" to take only 10 digits in input fiels

1 comment:

  1. Enpersol Technologies offers services ranging from SAP consulting, sap implementation, sap validation, support Partners, Sap Consultant, SAP Rapid Deployment services in pune and indore.

    ReplyDelete