3

I would like to make an input mask with javascript in Oracle Apex a bit prettier. How can I do that? Is there any way I can upload and embed a .js file? If so, how do you do it? Can I style whole pages with js and then upload it? I’m confused. Thank you

3 Answers 3

4

Step 1 open Shared Components and upload your .js script into static application files

enter image description here

Step 2 Upload the js script into Static Application Files and copy the reference, this reference works exactly the same as an URL

enter image description here

Step 3 In shared components open User Interface Attributes

User interface

Step 4 Paste it into Javascript / File URLS

enter image description here

Your script .js will be available in all your app, also you can add .css files in Cascading Style Sheets option

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

1

You can upload files to use as application or workspace resources, but for most static files (images, js libraries, etc.) you will get much faster response if you serve them from a separate web server and just put the links in your APEX code. For example, if you are using Apache HTTP or nginx as a reverse proxy for APEX you can serve them from there.

Comments

0

Select a page.

Click Edit Attributes.

Scroll down to HTML Header.

Enter code into HTML Header and click Apply Changes.

For example, adding the following would test a function accessible from anywhere on the current page.

<script type="text/javascript">
  function test(){
    window.alert('This is a test.');
  }
</script>

In Oracle Application Express you can reference a .js file in the page template. This approach makes all the JavaScript in that file accessible to the application. This is the most efficient approach since a .js file loads on the first page view of your application and is then cached by the browser.

The following demonstrates how to include a .js file in the header section of a page template. Note the line script src= that appears in bold.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>#TITLE#</title>
    #HEAD#
    <script src="http://myserver.myport/my_images/custom.js" type="text/javascript"></script>
</head>
<body #ONLOAD#>#FORM_OPEN#

1 Comment

This was the method in versions prior to 5.x, now there are dedicated attributes where you can apply either the JS code (without tags), or reference just the JS URLs (without tags)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.