Fork me on GitHub
Installation
  1. Download the APEX Live Validation plugin
  2. Import the plugin into your application
  3. Optionally style erroneous elements with CSS
    • Erroneous input items have the alv-item-error class assigned
    • The associated label has the alv-label-error class assigned *
    • Error messages have the alv-error-msg class assigned

* Only if the label element in your label template contains the following attribute for="#CURRENT_ITEM_NAME#"


Usage
  1. Create a new dynamic action
  2. Fire the dynamic action on the Page Load event
  3. Select the Live Validation [Plug-in] from the list of available actions
  4. Specify all details concerning the validation by filling out the Settings section
  5. HELP every setting has its own detailed help information
  6. Multiple validations can be added as an extra true action

As a best practice, it is advisable to separate client-side and server-side error messages. Client-side error messages are always shown inline, so it's a good idea to display server-side error messages in notification only.

Available Validations
# Validation Description Default Error Message
1 Required An item's value may not be empty. value required
2 Required (Trim Whitespace) An item's value may not be empty. Trailing and leading whitespace characters are ignored. value required
3 Item Type Check whether an item's value corresponds to the assigned item type (e.g. e-mail, date, number). not a valid number
not a valid digit combination
not an alphanumeric value
not a valid date (&1)
not a valid e-mail address
not a valid URL
4 Equality Check for equal values between two page items. values do not equal
5 Match Regex A value must match a given regular expression. invalid value
6 Character Length Limit an item's character length. value length too short - min. &1
value length too long - max. &1
invalid value length - between &1 and &2 only
7 Number Size Limit an item's number size based on a static value, or another item's value. number too small - min. &1
number too large - max. &1
invalid number size - between &1 and &2 only
8 Date Order Limit an item's valid date period based on a static value, or another item's value. this date should lie after &1
this date should lie before &1
this date should lie between &1 and &2
9 Checkboxes Put a limit on how many checkboxes can be checked. please select at least &1 choice(s)
please select no more than &1 choice(s)
please select between &1 and &2 choice(s)
10 Form Validate all form elements before submitting the page to the server. Please fix all errors before continuing

Available Events
# Event Description
1 Item Success Fires after validating a page item and no error was found.
2 Item Failure Fires after validating a page item and an error was found.
3 Form Success Fires after validating a form and no errors were found.
4 Form Failure Fires after validating a form and one or more errors were found.

Plugin Attributes
# Label Type Help Text
1 Validation Select List Select the type of validation you want to perform.
2 Item Type Select List Define what kind of item type validation should be applied.
3 Page Item(s) Multiple Page Items / Columns The page item(s) for which you want the above validation to apply. Separate multiple page items with a comma.
4 Triggering Event Select List Specify the JavaScript event that will cause the validation to fire.
5 Condition Textarea Optionally specify a JavaScript expression to support conditional execution of your validation. The validation will fire when the expression evaluates to true.
For example: $('#P5_COUNTRY').val() === "Belgium"
6 Must Equal Page Item / Column Select the page item that you want the value to be equal to. Frequently used to validate that two password fields are equal.
7 Regex Text This field allows specifying a regular expression that has to match the entered value.
For example: #[A-Fa-f0-9]{6}
8 Minimum Item Page Item / Column The page item that contains the minimum value. Overrides the 'Minimum' setting if filled in.
9 Maximum Item Page Item / Column The page item that contains the maximum value. Overrides the 'Maximum' setting if filled in.
10 Minimum Text A fixed minimum value. Gets overridden by the 'Minimum Item' setting if filled in.
11 Maximum Text A fixed maximum value. Gets overridden by the 'Maximum Item' setting if filled in.
12 Form(s) Text A jQuery selector to determine the form region(s) you want to validate before the page is submitted. Use a comma to separate multiple elements.
For example: #empForm,#deptForm
13 Form Submit Element(s) Text A jQuery ID selector to determine the buttons that submit the form. Use a comma to separate multiple elements.
For example: #createBtn,#saveBtn
14 Error Message Text Specifying an error message overrides the default error message. Use &1, &2, &n for substitution values.
15 Error Message Location Select List You can choose to show the error message before or after the input item.