 |
|
Oracle Application Express (APEX):
Creating an APEX Button to Call JavaScript
Oracle Tips by Burleson Consulting |
Creating an APEX Button to
Call JavaScript
Now you have setup the code in your application
page so that other page items can make calls to the functions
defined in the JavaScript. Let’s add the call to the JavaScript
code to the Submit button we created earlier.
In previous chapters we covered the creation of
a button and how to set properties to branch to another page, set
the HTML Request, clear page cache, and set item values. In those
sections the button performed the Submit by default, but in this
section we are going to override the default submit behavior of a
button and cause it to call our JavaScript. This is accomplished by
editing the button attributes for the Submit button and setting the
target URL to the code shown here
SEE
CODE DEPOT FOR FULL SCRIPTS
<a href="javascript:validateLogin('P4_USERNAME','P4_PASSWORD');">

Figure X.3 –
Calling JavaScript from a Button.
Even though you are setting the target to URL
you are not entering a traditional looking URL. Instead you are
entering a call to the JavaScript.
M
Your page items will likely have
different names than mine so make the necessary
changes before saving your changes.
|
Edit the attributes of the Submit button and
enter the text from above in the URL Target text area as shown in
Figure X.3. When the Submit button is clicked it will execute the
JavaScript.
APEX support:
 |
For APEX development support just call to gat an
Oracle Certified professional for all APEX development
projects. |
APEX book and code samples:
|