Adding Syntax Validation for Email Field

This validation ensures that a valid value is specified for the Email field.

Procedure

  1. Click the Email field.
  2. Click the Validations tab on the control’s Properties view.
  3. Click the Add New Validation button.

    The Define Validation dialog opens.

  4. In the Name field type the following:
    email_syntax
  5. Click the radio button On Form Submit.
  6. Type the following JavaScript code in the Script text area:
    var email = this.getValue();
    	if(email != null && email != "")
    	{
    			 //Match format xxx@xxx.xxx
     			var match = RegExp("(.)+@(.)+\\.(.)+").test(email); 
     			match;
    	}
     else
    	{
    		true;
     }
  7. Type the following text in the Message area:
    Email must be of the form xxx@xxx.xxx.
  8. Click Finish.