Example: Validate E-mail Id. We can use other validation (like PAN, SSN validations etc.) by changing the regular expression.
/***************************************************/
Function emailvlidation()
Local JavaObject &email_Regex = CreateJavaObject("java.lang.String", "^([0-9a-zA-Z]+[- ._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$");
Local JavaObject &Actual_String = CreateJavaObject("java.lang.String", EM_EMAIL.EMAIL_ADDR);
If &Actual_String.matches(&email_Regex) Then
/*Nothing*/
EM_EMAIL.EMAIL_ADDR.Style = "PSEDITBOX";
Else
EM_EMAIL.EMAIL_ADDR.Style = "PSERROR";
Error ("Please provide correct Email address");
End-If;
End-Function;
/***************************************************/
0 comments:
Post a Comment