Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Bypassing the When-Validate-Item trigger

Posted on 1999-07-19
Medium Priority
Last Modified: 2012-06-27
I have a text item in a block for which I wrote the When-Validate-Item
trigger to do the data validation. I have a Cancel button in the block. When
I press the Cancel button I want to close the block with out any validation. Everything is doing fine
when the entered value is the valid one in the text item. But when the
validation fails it is throwing the message box from the When-Validate-Item.

How can I make the code not to execute the when-validate-item trigger
when I press the Cancel button. For all the rest of the cases it should work.

Lot of thanks in advance.
Question by:lesa
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 35

Accepted Solution

Mark Geerlings earned 60 total points
ID: 1087577
There are at least two ways:
1. The easiest way (if you are going to close or exit the block anyway) is to do a "clear_record" first in the logic you execute with the "Cancel" button.

2. Another way is to to do a set_item_property in your "Cancel" button logic, setting the property, item_is_valid to TRUE for the text item.

Author Comment

ID: 1087578
I already have a clear_record in the When-Button-Pressed trigger of Cancel button, but the when-validate-item for the text item wil be executed when the focus leaves from the text-item. So when I press the button when-validate-item trigger is bieng raised before executing the code in the when-button-pressed for the Cancel button.
LVL 35

Expert Comment

by:Mark Geerlings
ID: 1087579
Yes, you are right, the when-validate-item trigger will fire first.  Does your when-validate-item raise an error if the text item is null?  If that is the problem, then move that check to the pre-insert and pre-update triggers instead.  Or, you could consider changing the validation unit in your form from the default (Item) to Record, but then you give up field-by-field validation.  Or, you can do what I have done, train the users to use the clear-record key when they need to cancel an action.

Expert Comment

ID: 1087580
What you can do is, in the cancel button property set 'mouse navigable' to false. You can also have 'keyboard navigable' to false. This should take care of the message when you click on cancecl button.  This is happening because, when you click on cancel button the cursor navigates to the button (so your field loses the focus) causing when-validate to fire.  This can be prevented by setting the above properties.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Via a live example, show how to take different types of Oracle backups using RMAN.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question