Oracle Portal allows you to create JavaScripts that perform validation on entry fields in forms and customization forms. Field-level validation is performed when the end user causes the OnBlur condition to occur after entering a value in an entry field, for example, when tabbing to another entry field. Form-level validation occurs after the user enters a value in an entry field and submits all values on the page, for example, when clicking an OK button.
Follow these guidelines when writing a field- or form-validation JavaScript. All validation routines should be written as functions, and return either TRUE or FALSE values.
The routine should alert the end user with a message if the element (entry field) being validated contains an invalid value.
The routine should bring focus (position the cursor) to the entry field where the user entered the incorrect value flagged by the JavaScript.
The following JavaScript validates that the user enters a numeric value into an entry field:
1) Identifies the name of the function and the entry field being validated.
2) Checks whether the absolute value of the entry field is a number. IsNaN ("Is Not a Number") is a JavaScript function.
3) If the value in the entry field is not a number, the user is alerted with the message, "Value must be a number."
4) The routine brings focus to the entry field.
Oracle Portal ships a default set of JavaScript routines.
You
must have Create or higher shared database portlet access privileges to
create a JavaScript.
You must have Manage shared database portlet access privileges to edit a JavaScript.
To build a JavaScript:
In the Oracle Portal Navigator, navigate to the list of JavaScripts.
Click Create>, then JavaScripts.
In the JavaScript Name field, type a descriptive name for the JavaScript; for example, NotNull for a JavaScript that ensures there are no null values in an entry field.
In the Language field, type the language in which the JavaScript will be written; for example, JavaScript1.1 or JavaScript1.2.
Click Next>.
Type or copy your JavaScript into the field provided.
Click Finish.
(optional) If you have Manage shared database portlet access privileges, you can edit the JavaScript you just created. To do so,click the Edit link in the Actions column in the Oracle Portal Navigator.
Notes
You can't edit System JavaScripts directly, but you can copy them, then edit the copy.
Default Javascripts
Testing Javascripts
Editing, deleting, and exporting shared database portlets