 |
|
APEX: Adding JavaScript to an APEX Application Page
Oracle Tips by Burleson Consulting |
Adding JavaScript to an APEX
Application Page
This section will show you how to create a
JavaScript script and add it to the page in the HTML Header
section. Then we will add code to the submit button to call the
JavaScript function – validateLogin – when the button is clicked.
When you are first developing the JavaScript
code it is common to put it into the HTML Header section as
indicated in figure X.1. Why you would want to put it here in the
first place is for development purposes. During developing you will
make changes to the code and keeping it here makes it easy to make
those changes. Later, after the code is finished being tested you
can move it to a JavaScript file where it can be reusable on many
application pages. We’ll cover that later in this chapter.
SEE
CODE DEPOT FOR FULL SCRIPTS

Figure X.1 –
JavaScript in HTML Header
section of page attributes.
Before you can call a JavaScript function you
first need to make it accessible to components on your application
page. This is done by adding it to the HTML Header region of the
Edit Attributes page. Navigating to the Edit Attributes page is
performed by clicking on the Edit Attributes button on the Page
Definition page.
After navigating to the HTML Header region type
in the code into the HTML Header text area as shown. Or you can
copy and paste the code from the code depot file listing_x_1.txt.
When you are finished putting the code in the
HTML Header text area, click on the Apply Changes button.
For more information on this topic, see the
book "Easy Oracle HTML-DB Application Express
", the best book anywhere on expert APEX
development:
 |
Easy Oracle HTML-DB Application Express
By Michael Cunningham & Kent Crotty
Only $27.95
Buy it now and get the code depot download
|
|