Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Trigger - Validation on Exit
In article <zkI2xFAkzEqzEwAG_at_idunn.demon.co.uk>,
Ian Dunn <ian_at_idunn.demon.co.uk> wrote:
>
> Hello ORACLE people
> I am using Forms 3 and Oracle 6 and I could do with some advice about
> trigger usage for validation and navigation. Basically, I have a small
> procedure, for example
> proc aa is
> begin
> if x is not null then
> if y is not null then
> go_field(‘x’);
> else
> message(‘error’);
> end if;
> end if;
> end;
>
> Ideally I would like it to go in the ON-VALIDATE-FIELD trigger, but I
> can’t due to the go_field, so I have put it in the KEY-NXTFLD trigger.
> Most of my other field validations use this trigger and when I do EXIT
> or COMMIT, if there is anything wrong then I am informed and then
> prompted with if I want to quit or not, which is what I want to happen.
> (By the way on the KEY-EXIT trigger I have exit_form and on the KEY-
> COMMIT trigger I have commit_form followed by exit_form.)
>
> BUT..ideally I want this procedure to work in the same manner. So I
> have put proc aa in the KEY-EXIT and KEY-COMMIT triggers, which works OK
> but I don’t get the option to quit if an error occurs. Do I have to
> live with this!!
In my opinion, you have this a bit turned around. Put all your validation code into on-validate triggers. If the item is not valid, don't forget to Raise Form_trigger_failure; immediately after your Message(error);
If the edit succeeds and you want to navigate to a different field, put that field immediately following the first field. If you can't place it following the first, then create a hidden field immediately following, and on that field, assign a when-new-field-instance (or whatever Forms3 calls it) with a go_field to the proper location.
Doing the above will allow your key-commit and key-exit triggers to work properly. If you don't want key-exit to stop if an edit fails, do a clear-form with the no_validate option within your key-exit process.
Regards,
Steve Cosner
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Fri Jun 20 1997 - 00:00:00 CDT