Forms 11g javascript integration: Call others

Forms 11g holds a lot of interesting new features focused on event-driven architecture, one of these is javascript integration. There are two ways of using javascript with Forms 11g: “call others” and “let others call you”.

Javascript can call code in Forms(“Let others call you”) using the new forms trigger “when-custom-javacript-event”.

This post is going to show you the first one: “call others”, in other words call javascript from your Oracle Forms application.

During the Forms Modernization Seminar I showed a google map that could be manipulated from an Oracle Form. It’s an easy implementation with only a few lines of code(most of the javascript is taken from the api examples on the google code site:
http://code.google.com/apis/maps/
).

  • Build a little form with one (control) block, one text field(to enter an address) and one button(to call the javascript code).
  • Next step is to create an HTML-page to display the form.

This code puts the form(in an iframe) and the map side by side:
(Click to enlarge)

And it will look like this:

  • The javascript that will be called is put in another file google.js:

  • The only thing to do is creating a “when-button-pressed” trigger in forms to call the javascript function showAddress.
    This is done by a new built-in procedure web.javascript_eval_expr:
  • Copy the HTML and javascript file to the following directory:
    <middleware_home>\user_projects\domains\<domain>\servers\WLS_FORMS\tmp\_WL_user\formsapp_11.1.1\e18uoi\war\
  • Create a new configuration using Enterprise Manager:

  • Make sure the parameter EnableJavascriptEvent is set to “true’ in your configuration!

And the working demo…

ApEx: Yellow Text Items

Today I came across a strange problem, I received an email of a customer with feedback about an application and the first line was: “Layout is nice but I don’t like the fact that certain text items have a yellow background”. I opened the application looking for yellow text items but I couldn’t find anything yellow so I emailed my customer for a screenshot:



Seeing the yellow text item I first inspected my items looking for something out of the ordinary but I couldn’t find anything special. After searching the internet for some time, I found finally an explanation. A user with the exact same problem posted that he had “google toolbar” causing the problem.

Seeing the screenshot above, I noticed that google toolbar was active. I then phoned my customer with the question for a screenshot without google toolbar:

My problem was found, the browser in question is IE 7.0. After some digging I came across code.jenseng.com where a workaround is explained. I will try some of their suggestions in the next couple of days…