Kbase 14095: Why LEAVE trigger data validation is a bad idea
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/11/1999 |
|
Why LEAVE trigger data validation is a bad idea
Many programmers attempt to mimic Version 6 field-level validation by
using LEAVE triggers in their GUI programs. This is not advised for
two reasons.
First, users of event-driven programs have certain expectations
about what they will encounter when they use their programs. These
expectations are commonly related to the "style rules" obeyed by all
applications written for use in that environment.
In both of the native GUI environments supported by PROGRESS (Motif
and MS-Windows) these native style rules include a stipulation
that an application not prevent navigation out of a widget
based upon the contents of that widget. In other
words, validation should be carried out only when a user has
signaled readiness by applying some sort of a "Save" event. Event-
driven programs by definition presuppose this type of user control.
When LEAVE trigger validation is used, an application in effect
takes over a vital part of "Save" event processing and moves it
to an inappropriate place. The resulting
behavior -- the insistence that focus remain on a particular
widget until its data requirement is satisfied -- confuses the
user with its variance from accepted GUI standards.
Second, the LEAVE trigger becomes a problem when a user decides that
he or she wishes to cancel data input altogether. For example, a
developer may provide a "Cancel" button on an interface to serve as
a mechanism for canceling. However, in order to click on the "Cancel"
button, the user must be able to leave whichever field he or she is
currently in. The LEAVE trigger prevents this, resulting in a
programming paradox: in order to cancel an interaction, the
user must first enter valid data as though the interaction were to be
completed. This can be confusing as well -- and frustrating.
For this reason, programmers are strongly discouraged from
incorporating LEAVE trigger validation in their event-driven
programs. Validation should be carried out using either schema
triggers or code that is included within the trigger block of
some sort of "Save" construct, such as a "Save" button.
If programmers insist on including LEAVE trigger validation then
they should refer to the following knowledgebase entry for code which
will allow them to do the validation:
17498 - How to Bypass a LEAVE Trigger when Clicking a Cancel Button
Progress Software Technical Support Note # 14095