Thursday, June 24, 2010

How to close the parent browser window when running Oracle Forms?


When a forms application is web deployed the parent browser window remains opens after exit_form. Is it possible to close the browser window programatically?

Oracle Forms does not provide any default functionality (e.g a built-in, package procedure or function, applet parameter etc) to close the parent browser window.

It is possible to create a work-around using non-Oracle javascript:
(SEE Special chapter for Internet Explorer version 7 ( IE7))

A: Closing the browser window using javascript called via WEB.SHOW_DOCUMENT.

1. Create a html file with the following code e.g.close.html for Internet Explorer:

<html>
<body onload="closeit()">
<script>
function closeit()
{
window.close();
}
</script>
</body>
</html>

2. Place in this html in a directory which can be accessed via a Oracle HTTP Server virtual directory / alias 

3. In the Forms module add the code  

WEB.SHOW_DOCUMENT('http://machinename.domain:portno/mydirectory/close.html','_self');

in a Post-FORM Trigger.

When the form is then run over the web, the trigger will fire calling the close.html which will in turn close the parent browser window.

B: Simulate Oracle Forms separateFrame=True using javascript

Create a HTML file with the following code:

<HTML>
<HEAD>
<TITLE>My HTML</TITLE>
<SCRIPT>
function my_function()
{
    // Replace Oracle.com URL below with typical Forms Servlet URL
window.open("http://machinename.domain:portno/forms/frmservlet?form=test.fmx","_blank","menubar=0, location=0,toolbar=0,personalbar=0,status=0,scrollbars=1
, resizable=1,width=700,height=550");
    
    // These lines close the first browser window after link is clicked.
    
    win = top;
    win.opener = top;
    win.close ();

}

</SCRIPT>
</HEAD>

<body onload="javascript:my_function">
<p align="center"><img border="0" 
src="http://www.oracle.com/admin/images/oralogo.gif" width="175" height="28">
<br>
<p align="center"><a href="javascript:my_function()">
Click me to run the application.</a> </p>
</body>

</HTML>



When this HTML page is run , it will have a link to launch the forms application. The application will display in a separate browser window (separateFrame=false). The javascript will, however, have removed the parent browser menu, toolbar, status bar and scrollbars. This makes it appear to the 
end user as though the forms application is running in it's own 'MDI' window.

Important Notes:

a. If separateFrame is set to true|yes in a config or default section of the formsweb.cfg it needs to be changed to separateFrame=false|no. Otherwise the result will still be the 'appearance' of a second (parent) browser window containing a black / grey rectangle.

b. When copying and pasting the sample code into a text file, remove any carriage returns which might result in the window.open line. Otherwise a javascript error will occur when clicking on the link to launch the forms application

c. FOR XP servicepack 2 users:

   SP2 has tighter security and shows the message despite the opener=top
   To avoid the message:
   1) in the HTMLbeforeForm parameter in formsweb.cfg the line:
     
   2) adding a "synchronize;" in the POST_FORM trigger before the 
      web.show_document

Source : Oracle Metalink Note 201481.1


Monday, June 7, 2010

The beginning...

This is a blog about my experience working with Oracle database, development tools and realted technologies. All the views expressed on this blog are my own. They do not necessarily reflect the views of my employing company and its affiliates.

How to Hide or Remove a Parameter from the Reports Parameter Form?


When you create a new user parameter, it is added to the parameter form automatically as you have seen.  The way to hide an undesired parameter is to de-select it from the parameter form builder.  Unfortunately, if you had already modified the parameter form, the layout and headers will be defaulted after you de-select the parameter.
 
Steps to remove the parameter from the form:

1. Open the report in Reports Builder
2. In the Object Navigator, double click on the icon next to Parameter Form
3. Note the layout and headers in this parameter form (there is no way to print this out to save)
4. Click on Tools from the menu
5. Click on Parameter Form Builder
6. Scroll to the bottom where your user parameters are listed
7. Click on the parameter you do not want to see (make it unhighlighted)
8. Click OK
9. This will replace what you already have built
10. Re-adjust parameter form to what you had in step 3