Assume, you have two forms A and B. Form A contains the list of registered members with a valid MemberID, who are eligible to subscribe through Form B. Hence, when a user submits data through Form B, we need to validate to check if the user is already a registered member in Form A.
This is achieved by writing On Add -> Validate script in Form B, as given below:
if (count(Form_A[MemberID == input.MemberID]) == 0)
{
alert " MemberID is not Found";
cancel submit;
}
1. The on add -> validate script is executed before submitting the form data in the database.
2. In the following code, the count built-in function will return the number of rows fetched from Form A, with the given criteria:
if (count(Form_A[MemberID == input.MemberID]) == 0)
3. The alert statement is executed if the count function returns 0
alert " MemberID is not Found";
4. cancel submit statement will cancel the record update operation.
cancel submit;