Home » Developer & Programmer » Forms » Change Forms trigger firing sequence
Change Forms trigger firing sequence [message #122140] Fri, 03 June 2005 05:18 Go to next message
t.paisley
Messages: 3
Registered: June 2005
Junior Member
Hi,
I've got a multi-row block (PARENTVAL) with a relation to another block (CHILDVAL).
My problem is that the WHEN-VALIDATE-RECORD trigger fires twice on the PARENTVAL block. I believe this is because it first fires the ON-CLEAR-DETAILS and ON-POPULATE-DETAILS triggers - and for some reason it fires the WHEN-VALIDATE-RECORD trigger from within the ON-POPULATE-DETAILS trigger and then again after it completed the ON-POPULATE-DETAILS trigger.

I've re-coded the KEY-UP/DOWN/NXTREC/PREVREC triggers for navigation using keys and this forces the ON-CLEAR/ON-POPULATE-DETAILS triggers to be fired AFTER the WHEN-VALIDATE-RECORD, but I don't know how to do this for mouse navigation. Does anybody have any ideas?

Thanks,
Tanja
Re: Change Forms trigger firing sequence [message #122315 is a reply to message #122140] Sun, 05 June 2005 21:25 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Easy with the triggers!!

May I humbly suggest that you recreate this form. Just have your PARENTVAL and CHILDVAL blocks. Use the wizards to create them. Then build your relationship using the relationship wizard. Test your form. Add the WVR trigger and see how often it fires. Now add your custom code. Again, see how often it fires.

I suspect that somewhere in your custom code you are CHANGING a value in PARENTVAL after it has been validated and that is why the WVR is firing a second time.

May I also suggest that you control record behaviour using when-new-record-instance versus up/down/nxt/prev.

David
Re: Change Forms trigger firing sequence [message #122471 is a reply to message #122315] Mon, 06 June 2005 11:42 Go to previous messageGo to next message
t.paisley
Messages: 3
Registered: June 2005
Junior Member
Thanks for you help, David!
I tried what you suggested and the problem seems to be that I raise a FORM_TRIGGER_FAILURE in my WHEN-VALIDATE-RECORD trigger to prevent the user from navigating into another record (I want them to correct the error before they can move on). Are there any other ways of achieving this?!?
Tanja
Re: Change Forms trigger firing sequence [message #122505 is a reply to message #122471] Mon, 06 June 2005 19:00 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
You could try a when-validate-item so that they have to fix each item as they go, and then, as belt-and-braces security, do them again in the WVR.

But what is wrong with what you have? You have raised the error and the user has been kept in the incorrect record. They fix it, the WVR fires, and they move on to the next record.

David
Re: Change Forms trigger firing sequence [message #122563 is a reply to message #122505] Tue, 07 June 2005 05:34 Go to previous messageGo to next message
t.paisley
Messages: 3
Registered: June 2005
Junior Member
My problem is that the error message fires twice and has to be confirmed twice. It's just not very neat.
I tried using the WHEN-NEW-RECORD-INSTANCE trigger instead of the up/down/nxt/prev triggers as you suggested, but WHEN-NEW-RECORD-INSTANCE fires after WHEN-VALIDATE-RECORD as opposed to the up/down/nxt/prev triggers who fire beforehand (ie. using up/down/nxt/prev prevents WVR from firing twice (when using keys), WNRI doesn't). I think I might just leave it and see if the users notice it...
Re: Change Forms trigger firing sequence [message #122666 is a reply to message #122563] Tue, 07 June 2005 21:28 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
My first suggerstion is that you use the WHEN-VALIDATE-ITEM trigger on each of the data fields. Then use WVR. I only use the WNRI to enable and disable fields for navigation and access/permission purposes. I recommend that you DON'T use up/down/nxt/prev for doing validation.

David
Previous Topic: D2K project deployment
Next Topic: frm-41017 and frm-41316
Goto Forum:
  


Current Time: Fri Sep 20 10:42:51 CDT 2024