11.01.2013 Views

Oracle Forms Developer – Form Builder Reference, Volume 1

Oracle Forms Developer – Form Builder Reference, Volume 1

Oracle Forms Developer – Form Builder Reference, Volume 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

On-Message trigger<br />

Description<br />

Fires whenever <strong>Form</strong> <strong>Builder</strong> would normally cause a message to display and pre-empts the message.<br />

Definition Level form, block, or item<br />

Legal Commands<br />

SELECT statements, unrestricted built-ins<br />

Enter Query Mode yes<br />

Usage Notes<br />

Use an On-Message trigger for the following purposes:<br />

• to trap and respond to an informative message<br />

• to replace a standard informative message with a custom message<br />

• to exclude an inappropriate message<br />

• Use the MESSAGE_CODE, MESSAGE_TEXT, MESSAGE_TYPE built-ins in an On-Message<br />

trigger to identify the occurrence of a specific message condition.<br />

• If you use the On-Message trigger to trap a message so that it does not display on the message line,<br />

the GET_MESSAGE built-in does not return a value. To display the current message from this<br />

trigger, you must trap the message and explicitly write it to the display device.<br />

• In most cases, On-Message triggers should be attached to the form, rather than to a block or item.<br />

Trapping certain errors at the block or item level can be difficult if these errors occur while <strong>Form</strong><br />

<strong>Builder</strong> is performing internal navigation, such as during a Commit process.<br />

On Failure<br />

no effect<br />

On-Message trigger examples<br />

Example<br />

The following example responds to an error message by displaying an alert that gives the user a message<br />

and gives the user the choice to continue or to stop:<br />

DECLARE<br />

alert_button NUMBER;<br />

lv_errtype VARCHAR2(3) := MESSAGE_TYPE;<br />

lv_errcod NUMBER := MESSAGE_CODE;<br />

lv_errtxt VARCHAR2(80) := MESSAGE_TEXT;<br />

BEGIN<br />

IF lv_errcod = 40350 THEN<br />

alert_button := Show_Alert(’continue_alert’);<br />

IF alert_button = ALERT_BUTTON1 THEN<br />

452

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!