15.2 Understanding Validations
Use validations to create edit checks on specific items, pages, or columns.
- About Validations
Learn about validations. - What Happens When a Validation Fails?
Learn what happens when a validation fails. - Creating a Validation
Create validations in Page Designer. - Editing a Validation
Edit validations in Page Designer. - About Determining When Validations Execute
Determine when a validation executes by editing the Always Execute attribute. - About Defining How Validation Error Messages Display
Control how validation messages display by editing the Error Message and Error Message attributes. - Processing Validations Conditionally
Control when and if a validation executes by configuring the Server-side Condition attributes. - About Altering the Go to Error Link
Alter the Go to Error text to change the default text or to translate it into a language that is not translated by default.
Parent topic: Managing Computations, Validations, and Processes
15.2.1 About Validations
Learn about validations.
A validation is an edit check. Validations specific to a single item are page item validations. Validations that apply to an entire page are page validations. Validations for tabular forms specific to a single column are column level validations. Validations for tabular forms that do not apply to a single column are tabular form row validations.
You can define a validation declaratively by selecting a validation method. You enter the actual validation edit check in the Validation Messages field. Be aware that if a validation fails, subsequent page processes or computations do not occur. Also remember that the validation you enter must be consistent with the validation type you selected.
Parent topic: Understanding Validations
15.2.2 What Happens When a Validation Fails?
Learn what happens when a validation fails.
If a page is submitted and some of the validations fail, Oracle APEX redisplays the existing page with all inline validation errors. While displaying inline errors, APEX does not execute computations, application processes, or page processes (for example, Automated Row Fetch) which are defined to execute during Page Rendering (in other words, all "On Load %" display points). The one exception is if the computations and processes use the condition type Inline Validation Errors Displayed.
The reason for skipping these computations and processes is that any of they could potentially alter the data entered by the user. For example, an Automated Row Fetch process would fetch and overwrite the modified data with the values from the database when the user actually wants to get the entered data in order to fix the validation error.
If a computation is skipped, the following displays in the debug output:
Do not perform computation because inline validation errors found.
If an application or page process is skipped, the following displays in the debug output:
Skip because inline validation errors found.
Parent topic: Understanding Validations
15.2.3 Creating a Validation
Create validations in Page Designer.
Note:
Text entered for validations may not exceed 3,950 characters.
To create a validation in Page Designer:
15.2.4 Editing a Validation
Edit validations in Page Designer.
To edit a validation in Page Designer:
Parent topic: Understanding Validations
15.2.5 About Determining When Validations Execute
Determine when a validation executes by editing the Always Execute attribute.
The Always Execute attribute determines if validations execute when a page is submitted. Use this attribute for buttons or certain page items that submit a page. The Always Execute attribute has two options:
-
On - The validation always executes independent of validation settings for buttons or items on a page.
For example, select On if your validation is a security check which determines if the current user is allowed to modify or delete the current record. This ensures the validation executes for any operation and prevents unprivileged users from modifying data.
-
Off - The validation only executes if the button or item used to submit the page has the Execute Validations attributes set to On.
For example, it is not useful to verify that an item be numeric and display an error message if the user is simply deleting a record. In that scenario, the validations should only execute when the user clicks the Create or Apply Changes buttons.
To accomplish this behavior:
- For the validation, set Always Execute to On
- For the Create and Apply Changes buttons, set Execute Validations to On.
- For the Delete button, set Execute Validations to Off to avoid unnecessary validations.
See Also:
Parent topic: Understanding Validations
15.2.6 About Defining How Validation Error Messages Display
Control how validation messages display by editing the Error Message and Error Message attributes.
You can choose to have validation error messages display inline (that is, on the page where the validation is performed) or on a separate error page.
You define how a validation error message displays by configuring the following validation attributes:
- Error, Error Message - Enter the error message text in this field. You can use
#LABEL#
as placeholder for the label of the associated page item or#COLUMN_HEADER#
for the heading of the associated editable region column. The placeholders are not supported if error display location is set to On Error Page. -
Error, c - Select where the error message displays for this validation. Validation error messages display on a separate error page, or inline with the existing page. Inline error messages display underneath the Associated Item label and/or in a Notification area, defined as part of the page template.
Options include:
- Inline with Field and in Notification - Error displays inline within the field label and within a notification area (defined as part of the page template).
- Inline with Field - Error displays inline within the field label.
- Inline in Notification - Error displays inline within a notification area (defined as part of the page template).
- On Error Page - Displays the error on a separate error page. To create a hard error that stops all processing (including validations), you must display the error on an error page.
-
Error, Associated Item (or Column) - Select the item (or column) where this validation error message displays.
If you select an item and the Error message display location includes Inline with Field, the error message displays underneath the label of the specified item. If the Error message display location does not include Inline with Field, this attribute has no impact on the display of the error message.
See Also:
Parent topic: Understanding Validations
15.2.7 Processing Validations Conditionally
Control when and if a validation executes by configuring the Server-side Condition attributes.
You can control when and if a validation executes by configuring the following Server-side Condition attributes:
Parent topic: Understanding Validations
15.2.8 About Altering the Go to Error Link
Alter the Go to Error text to change the default text or to translate it into a language that is not translated by default.
If you define an associated item, Oracle APEX renders a Go to Error link in the Notification display location next to the corresponding error message. When clicked, the user's focus is set to the associated item.
You can alter the Go to Error text to change the default text or to translate it into a language that is not translated by default with APEX. In either case, define a text message called APEX.GO_TO_ERROR
with the text and language of your choice. Additionally, you can disable this functionality and remove the Go to Error link by setting the text of the APEX.GO_TO_ERROR
text message to just a single space.
Parent topic: Understanding Validations