About JavaScript Events Calling into Oracle Forms

You can also allow JavaScript calls into Oracle Forms by using JavaScript in the Web page that hosts the Forms applet.

There is new functionality available on the embedded Forms object in the DOM (Document Object Model) tree. You use JavaScript to do:

document.forms_applet.raiseEvent(event_name, payload);

The assumption here is that you have set the ID configuration variable to forms_applet.

When the surrounding Web page executes this JavaScript code, Oracle Forms fires a new type of trigger called WHEN-CUSTOM-JAVASCRIPT-EVENT. In this trigger there are only two valid system variables: system.javascript_event_value and system.javascript_event_name. These variables contain the payload and event name that were passed into Forms through the raiseEvent method. On calling the raiseEvent method, a trigger named WHEN-CUSTOM-JAVASCRIPT-EVENT is fired on the server side.

declare
    event_val varchar2(300):= :system.javascript_event_value;
begin
    if (:system.javascript_event_name='show') then
        handleShowEvent(event_val);
    elsif(:system.javascript_event_name='grab') then
	  handleGrabEvent(event_val);
    else
        null;
    end if;
end;

This PL/SQL code recognizes two events: 'show' and 'grab'. Any other name is ignored.

Reason to Let Events Call into Oracle Forms

You can synchronize an HTML based application, whether it is Java-based or otherwise, with a Forms-based application in the same hosting Web page. For example, you can use the HTML-based application to query data and use Forms to update it if, and only if, the user has the correct access privileges.