• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 11556
  • Last Modified:

Forms6i: Post-Text-Item and Pre-Text-Item


I'm using forms 6i on Oracle9i database.
I have 2 blocks, block 1 -> CTL_1_BLK has 3 text items(txt1,txt2 and txt3). and 2nd block -> CTL_2_BLK has 2 buttons (APPLY and REVERT).

In BLOCK CTL_1_BLK i have two triggers POST-TEXT-ITEM and PRE-TEXT-ITEM written in BLOCK LEVEL.

In Pre-Text-Item i'm storing old value (before user enters new value) into a variable :parameter.pre_value and in Post-Text-Item i'm storing new value entered by user in :parameter.post_value. In POST-TEXT-ITEM i'm comparing old and new values(stored in 2 parameters) if the values are changed i will update the changed value ( here i will provide a confirmation window to user-- YES or NO ) If user clicks on YES from the confirmation window will update the database else if user clicks on NO i will revert back to old value which was stored in parameter during PRE-TEXT-ITEM trigger.

My question is, If I change the "txt_1" value and i click on apply i will be getting confirmation window( because post-text-item trigger will fire). If i click on Revert button (in 2nd block) again it will display the confirmation window.
Here some how i have to avoid to display this confiration window when user clicks on REVERT BUTTON, ie. some how i have to hide this confiramation window as soon as user clicks on REVERT BUTTON.

Can anyone give me the inputs..

   TRIGGERS --- POST-TEXT-ITEM ( stores new value and calls alert depending on check between :parameter.pre_value and :parameter.post_value)
            --- PRE-TEXT-ITEM (stores pre value)
   ITEMS    --- TXT-1
            --- TXT-2
            --- TXT-3
   ITEMS    --- APPLY
   ITEMS    --- REVERT
1 Solution
Mark GeerlingsDatabase AdministratorCommented:
I usually avoid pre-text_item and post-text-item triggers because they are fired more frequently than you expect, and at some times that you might not expect.

Is the block with the data items based on a table or view?
If it is, I would suggest creating some non-displayed items in the block, one for each displayed item to hold the "pre" value.  You can populate them all with a post-query trigger.  You don't need post-text-item triggers or a place to hold the "after" values since they are available directly in the items the user has access to.

You can then use a when-validate-item trigger to pop up a confirmation alert if the value has been changed.  Another option would be to use a when-validate-record trigger so that there would be only one confirmation alert regardless of how many items were changed.

If the block is not a base-table block, then the coding becomes more complex.  Oracle Forms may not be the best or easiest tool to use for non-base table forms.
If I understand your question, I think you want to set the Mouse Navigate property for the Revert button to NO.  Then, in a When-Button-Pressed trigger on the Revert button, set the value of the current item (use SYSTEM.CURSOR_ITEM to get current item) to :parameter.pre_value

Example:  COPY( :parameter.pre_value, :System.Cursor_Item);
asuresh73Author Commented:

I was able to solve this problum. Thankz of co-operation.
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Mark GeerlingsDatabase AdministratorCommented:
If one of the responses helped you solve the problem, then please accept that as the answer to close the question.  Also, please leave a comment to describe how you solved it, since that may help others.
Hi ASuresh,

What i inferred from your problem is that you want to apply the changes if the button is pressed and also the two values are different.
What i propose is that you call the alert on when button pressed trigger of the apply button rather than calling it on the poat text item
this way  when you press the apply button then only it will ask for a confirmation

I guess it will help

If i am not able to infer correctly from your problem then sorry about it

Please do write i will try my bst to help

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Split between markgeer & ser6398
Please leave any comments here within the next seven days.
EE Cleanup Volunteer

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now