Previous
Previous
 
Next
Next

Creating a Validation

To create a validation:


Note:

Text entered for validations may not exceed 3,950 characters.

  1. Navigate to the appropriate Page Definition. See "Accessing the Page Definition".

  2. To access the Create Validation Wizard:

    • Tree view - Under Page Processing, right-click Validating and select Create Validation.

    • Component view - Under Page Processing, locate Validations. Click the Create icon.

    The Create Validation Wizard appears.

  3. Select a validation level and click Next:

    • Item Level Validations are specific to a single item.

    • Tabular Form Validation are specific to a tabular form.

    • Page level Validation do not apply to any single item, but apply to an entire page.

  4. If you selected Item level validation, select the item to be validated and click Next.

  5. For Validation Method, select a method as described in Table: Validation Methods and click Next.

    Validation Methods

    Validation Method Descriptions

    SQL

    Compares item values to data in the database.

    For example, you can use a SQL validation to verify whether a last name typed into a field exists in the database. In the following Exists SQL validation, the field is named P1_LAST_NAME and the table is named customers.

    SELECT 1 FROM customers 
    WHERE last_name = :P1_LAST_NAME
    

    PL/SQL

    Useful if you need complex logic to validate entered data.

    For example, suppose you need to create a validation for an address form that requires the user to enter a province if the address is not in the United States. You could create the validation as a Function Returning Boolean, using the following PL/SQL:

    BEGIN
      IF :P1_COUNTRY = 'US' AND :P1_PROVINCE IS NULL THEN
         RETURN FALSE;
      ELSE
        RETURN TRUE;
      END IF;
    END;
    

    You could also create the same validation implemented as a PL/SQL Expression as follows:

    NOT (:P1_COUNTRY='US' AND  :P1_PROVINCE IS NULL);
    

    Item Not Null

    Checks if an item's value in session state is null.

    For example, you could validate that the user enters a value in a field by creating an item validation and then selecting the validation method Item Not Null.

    Item String Comparison

    Compares the value of an item to a specific string.

    There are several string comparison validations that compare the value of an item to a literal string. For example, you select the validation type Item in Expression 1 is contained in Expression 2 to validate a user entry in a field against a list of values you provide.

    In Expression 1, enter the name of the item you want to validate without a colon. For example:

    P1_VALUE
    

    In Expression 2, enter a string of values you want to validate against. For example:

    ABC/DEF/GHI
    

    Regular Expression

    Regular expressions provide a method to describe text patterns. Use a Regular Expression validation to perform data validation.

    For example, you could use the following regular expression validation to verify that a string of entered data always consists of groups of six numbers separated by commas and followed by a comma:

    ^([[:digit:]]{6},)+$
    

    This regular expression would find the following entries valid:

    123456,654321,

    123456,

    123456,123456,654321,

    However, the following would not be valid:

    123456,12345

    12345


  6. For SQL, PL/SQL, and Item String Comparison validations, select the type of validation you want to create and click Next.

  7. Specify the sequence and validation name and click Next.

  8. For Validation:

    • Depending upon the validation method, enter the validation or message text that displays if the validation fails.

      You can use the placeholders #LABEL# or #HEADING# to get the current page item label or column heading when the error message displays.

    • For Always Execute, select Yes or No. This attribute determines if validations execute when a page is submitted. Use this attribute in conjunction with the Execute Validations attribute for buttons or certain page items that submit a page.

      If you select Yes, the validation always executes independent of validation settings for buttons or items on a page. Note that any defined conditions still apply.

      If you select No, the validation only executes if the button or item used to submit the page has the Execute Validations attributes set to Yes.

  9. Click Next.

  10. Define conditions that apply to this validation and click Create.