Order of Events - InfoPath Dev
in

InfoPath Dev

Order of Events

Last post 04-03-2007 03:25 AM by stumbler. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 04-01-2007 04:36 AM

    Order of Events

    Hello,

    I have a general question concerning the order of events.
    On a control one can choose between
    Onbeforechange
    onvalidate
    onafterchange.
    I wonder when the onvalidate event is triggered exactly and when the onafterchange is triggered?
    I ask this question because now I use an onafterchange event and I have the impression that it is triggered twice each time the form get populated with the data source data. I tested it with a popup and it appears twice for each record.
    Hans.
    Infopath 2003 / Jscript
  • 04-02-2007 12:08 AM In reply to

    Hi stumbler,

    OnBeforeChange occurs when the change has been made but not yet accepted or finalized. Code in this event procedure can examine the new data value and, if it doesn't meet the form's requirements, reject it and keep the old data value.

    OnValidate occurs after OnBeforeChange, when the change has still not been finalized. It is like OnBeforeChange in that code examines the data value to see if it is acceptable. It differs from OnBeforeChange in that it does not offer the ability to automatically roll back the data to the previous value. Rather, it lets you display a validation error message to users to prompt them to fix the data.

    OnAfterChange occurs when the change has been accepted and finalized. It is typically used to perform calculations or other updates to the form based on the new data. Strictly speaking, this event really isn't used for data validation but rather to initiate some action after the data has been accepted.

    Hope this will help you
    B.Shiva Prasad
    InfoPath Dev,
    http://www.ggktech.com
    India
  • 04-02-2007 01:16 AM In reply to

    Thanks for the explanation.
    But I don't understand why the onAfterChange event is triggered twice for each record. Or is my code the problem?

    Hans.
    Infopath 2003 / Jscript
  • 04-02-2007 03:29 AM In reply to

    Hi stumbler,

    Its not at all your falut, onAfterChange for a control means when you make any changes in that control it will show the message.

    Here you are entering a value in that control for that first time it will show once the message and in the next time you are deleting that value and entering another value means you are doing changes twice thats why the message is coming twice.

    Hope you understand.
    B.Shiva Prasad
    InfoPath Dev,
    http://www.ggktech.com
    India
  • 04-03-2007 03:25 AM In reply to

    Thanks, now it's clear although it doesn't seems very logic to me.
    Hans.
    Infopath 2003 / Jscript
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.