Adding a Second Validation for Email Field

This validation ensures that a value is specified for either the Email or Phone field. The user is not required to provide values for both in this application.

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 specify the following:
    email_or_phone_required
  5. Click the radio button On Value Change.
  6. Type the following JavaScript code in the Script text area:
    //Check one of email and phone fields are entered
    if((f.CustPhone == null || f.CustPhone == "") &&
       (f.CustEmail == null || f.CustEmail == "")){
         false;
       } else{
         true;
       }
  7. Type the following text in the Message area:
    Either customer phone number or email address must be entered.
  8. Click Finish.