Online Tutorials & Training Materials | STechies.com
Register Login

Code for Email id and Phone Number validations in SAP UI5/FIORI.

29 Jan 2016 6:08 pm || 0

We really need not write code from scratch level, instead we can directly take existing java script code and adjust code as per our screens and implement under function of SAP UI5/FIORI .

For example :

function submitfun( )

var content = oSimpleForm.getContent( );
var emailvalue = content[7].getValue();
var atpos = emailvalue.indexOf("@");
var dotpos = emailvalue.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
sap.ui.commons.MessageBox.alert("Not a valid e-mail address");
}
}