Re: Please HELP - Forms 4.5

From: Steve Cosner <stevec_at_zimmer.csufresno.edu>
Date: 1997/11/14
Message-ID: <879528551.9657_at_dejanews.com>#1/1


In article <346b0054.175652815_at_news.services.fccc.edu>,   am_balshem_at_fccc.edu (Andrew M. Balshem) wrote:

>

> We've a very simple forms 4.5 application (10 fields). ID and SPECIES
> fields cannot be null. I've a trigger on both fields to make certain
> that neither are null.. When I enter the form my first enterable
> field is ID and the cursor is placed there. If I click anywhere
> prior to entering the ID I receive an error (that I must enter ID) as
> I should. However, after I've entered ID if I use my mouse to skip
> over the SPECIES field I don't get a similar error unless I've first
> entered the SPECIES field. I've tried using each of the WHEN-MOUSE...
> triggers to no avail. I do have a pre-insert/update trigger that
> checks that both fields are not null & these do prevent commiting bad
> data to the database. I would, however, like to write a trigger to
> immediately inform the user that SPECIES cannot be null whenever
> they've used a mouse to skip over the field. Any solution?

I use the following method. Then if the user tries to go to any other item in the block, the cursor always goes back to the null required item.

Use a block-level When-New-Item-Instance trigger. In it, check ID and Species for null, if either is, and if the trigger item is not in ID or Species, then navigate to the first null one:

If :System.Trigger_Item not in('BLK.ID','BLK.SPECIES') then   If :Blk.ID is null then
    Go_Item('BLK.ID');
    Message (' ID IS REQUIRED');
    Raise Form_Trigger_Failure;
  Elsif :Blk.Species is null then
    Go_Item('BLK.SPECIES');
    Message (' SPECIES IS REQUIRED');
    Raise Form_Trigger_Failure;
  End if;
End if;

You also need to do something to force the user to enter a value in both fields before leaving the row. I do it in a When-Validate-Record trigger, but navigating the cursor to the correct null field is tricky. You could do it easier by using When-Validate-Item triggers or by setting the Required attribute to True. Using pre-insert and pre-update triggers for validation is not a good place to do it, since it allows the form to post other changes to the database prior to detecting your validation error.

Steve Cosner
http://members.aol.com/stevec5088

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Fri Nov 14 1997 - 00:00:00 CET

Original text of this message