Sunday, October 28, 2007

APEX + PL/SQL + HTML + JAVASCRIPT (Part 2)


OK, the second half of this problem....I am not sure if I have a bad Application Express program or something somewhere in the C drive of my computer......but, through all of the onMouseover tutorials and application downloads, I could not get any to work out correctly. For some reason the "BODY HEADER" section on my HTML regions would not put the javascript onMouseover graphic on the cursor...it would automatically go to the upper left corner of the application......I used the following tutorials and had the same result:
APEX Javascript Documentation:
http://download.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32469/javascript.htm#CIHEBFFC
Aria Employee Look Up Application:
http://www.oracle.com/technology/products/database/application_express/packaged_apps/packaged_apps.html#PEOPLE

Neither of these would work, so I went to something more user friendly...Patrick Wolf's blog post for onMouseOver calls....a very simple and straight forward command to be used, and it worked:

http://inside-apex.blogspot.com/2007/08/using-tooltips-in-oracle-apex.html

Like I said, this worked, but I could not get it to work for dynamic PL/SQL content. So, after much nashing of teeth, searching of the Oracle Forum's and Googling like mad....one week later and a few Grimbergers later....I finally found a solution that would allow me to put:
DYNAMIC PL/SQL INFORMATION INTO A JAVASCRIPT TOOLTIP THAT SHOWS IN AN HTML TABLE CELL when the mouse moves over it.....here is the skinny:

First, link up your javascript in the HTML header output using this:
htp.p('<script language="javascript" src="#WORKSPACE_IMAGES#apexwonder_tooltip.js"></script>');

Second, put the call to the javascript and the dynamic data (capframe) into the table cell using this:

htp.tableData( ' ', cattributes => ' bgcolor=#990066 onmouseover="Tip('''||capframe||''')"');

CATTRIBUTES is something that I still need to get to know. It looks like it has some powerful HTML output functionality. "TIP" is the call to the javascript function. The term "capframe" is the variable holding the dynamic data to put in the tooltip itself. The three single quotes and the concatenation operators are very important to note! It is also hard to see the apostrophes on the right side at the end, but that is a double quote and a single quote, not three single quotes:)

So there we have it, a dynamic tooltip for use in a PL/SQL region.

Here is a picture...please forgive the lack of nice CSS formatting....

3 comments:

Dimitri Gielis said...

"Grimbergers" ... do you know where that comes from? ;-)

Dimitri

Jason said...

Ha...yes...I believe it might be somewhere near the Netherlands...a place called Belgium (Belgie);-).

Unknown said...

JavaScript is a good program and very easy to use. I don´t like a complex program. I prefer javascript because i consider it like a device very eficient and it have a good quality.
I always looking for the quality that is why i prefer to buy viagra because i always have a great result in my sexual life.