Forum Stats

  • 3,839,017 Users
  • 2,262,438 Discussions
  • 7,900,836 Comments

Discussions

when-validate-item fires at the wrong time?

MikeLi
MikeLi Member Posts: 83
edited Sep 20, 2009 2:36AM in Forms
Hi,

I have a custom form that contains a header block and line block. Once I enter the header info, then I enter the first line that contains transaction num and amount fields. Then I hit down-arrow to go to enter the second line, at this point when-validate-item triggers for all the line fields fire again (these triggers already fired one at a time when i navigated through the line).

Supposedly ONLY when-create-record, when-new-record-instance and when-new-item should fire when I just move to a new line, any ideas?

Thanks! Mike.
Tagged:

Answers

  • Magoo
    Magoo Member Posts: 1,495
    Hi!
    If your when-create-record may inserts data in some items, if you change the record, all items are getting vaildated.
    You can change that by setting the Validation Unit Form Property to block, i think.
    Regards
  • MikeLi
    MikeLi Member Posts: 83
    Thanks for the info. I do need to keep that "Validation Unit" to Default so validations kicks in on item-level. I don't have any when-create-record trigger at all so I don't think that is the issue.
  • Magoo
    Magoo Member Posts: 1,495
    if your when-validate-item triggers fire and may change the data of the associated item,
    changing the record will let fire the validate-triggers again.
  • user4862029
    user4862029 Member Posts: 31 Blue Ribbon
    Mainly WHEN-VALIDATE-ITEM is used for SINGLE-RECORD block, you can use for MULTI-RECORD block as well, but you need to set REQUIRED property dynamically based on your conditions using Set_Item_Instance_Property to stop firing trigger.
    EX: Set_Item_Instance_Property( '<BLOCK.ITEM_NAME>',CURRENT_RECORD,REQUIRED,PROPERTY_FALSE);
  • MikeLi
    MikeLi Member Posts: 83
    Thanks for all the inputs. The user can either use txn number or BOL number to populate the line info and I have LOV (list of values) for both numbers. The problem turned out is that each LOV updates the other value (e.g. the txn number's LOV returns the txn number AND the BOL number). This in turn changed the value of a validated item and that causes when-validate-item to fire when I just tried to leave the record.

    The solution is to set IS_ITEM_VALID property for Txn Number to TRUE after BOL number's LOV updates the Txn number's value. This tells the system there is no need to revalidate the value.
This discussion has been closed.