Home » Developer & Programmer » Forms » example of Pre-block
example of Pre-block [message #82425] Mon, 26 May 2003 05:59 Go to next message
Mubeen.
Messages: 37
Registered: May 2003
Member
hi,All

please give me an example about the usage of pre-block trigger.

suppose unless the user clicks any of the item in the current block the cursor should not move to the next block.and also put an alert message in the example

please give me an example.

thanx in advance.

mubeen.
Re: example of Pre-block [message #82429 is a reply to message #82425] Mon, 26 May 2003 07:46 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
You could create a parameter which is filled each time you push a button in block1 (button_block). In the PRE-BLOCK of block2 (data_block) you check whether the parameter is filled. If not "RAISE form_trigger_failure;". In the POST-BLOCK you could set the parameter to NULL which causes that once a user has left the block he has to access the block with the buttons. Here's what you could put in the Triggers:
WHEN-BUTTON-PRESSED (block1)
Declare
	v_text     VARCHAR2(2000) := 'You have selected to ';
	v_alert_id Alert;
	v_button   Number;
Begin
	v_alert_id := Find_Alert('AL_TEST');
	If Not Id_Null(v_alert_id) Then		
		v_button := Show_Alert(v_alert_id);
		If v_button = ALERT_BUTTON2 THEN -- cancel
			RAISE Form_Trigger_Failure;
		Else
			:Parameter.par_action := get_Item_Property(:system.cursor_item,Label);
			go_block('BLOCK2');
		End If;
	Else
		Message('Alert not found. Action Cancelled.');pause;
		Raise Form_Trigger_Failure;
	End If;
End;

PRE-BLOCK (block2)

IF :PARAMETER.PAR_ACTION IS NULL THEN
	message('hela, find a button to press');
	pause;
	RAISE FORM_TRIGGER_FAILURE;
END IF;

POST-BLOCK (block2)
:PARAMETER.PAR_ACTION := NULL;
MHE
Previous Topic: block processing..
Next Topic: Forms 6i Web test
Goto Forum:
  


Current Time: Fri Mar 29 02:10:48 CDT 2024