Why is OnAfterChange firing twice? - InfoPath Dev
in

InfoPath Dev

Why is OnAfterChange firing twice?

Last post 09-29-2005 11:04 PM by Patrick Halstead. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-23-2005 10:44 AM

    Why is OnAfterChange firing twice?

    I have some checkboxes in a form that can perform a couple of functions depending on the value of a textbox. Things work correctly, except that OnAfterChange is firing twice, and I have no idea why...

    Here's a simplified snippet:


    [InfoPathEventHandler(MatchPath="/my:Form/my:Checkbox", EventType=InfoPathEventType.OnAfterChange)]
    public void Checkbox_OnAfterChange(DataDOMEvent e)
    {
    string myTextboxText = thisXDocument.DOM.selectSingleNode("/my:Textbox").text;
    if(myTextboxText != "")
    thisXDocument.UI.Alert("Please enter something in the textbox");
    }


    Any help you can provide is greatly appreciated.

    Thanks,
    -DC Ross
  • 09-23-2005 07:48 PM In reply to

    Re: Why is OnAfterChange firing twice?

    Checkboxes receive an e.Operation of Delete and then Insert.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 09-26-2005 05:13 AM In reply to

    Re: Why is OnAfterChange firing twice?

    I have noticed similar things in the past with the events being raised. Seems a little weird. This is an event that is raised off the XML DOM? If so, do you know where I can go read up on this topic? W3C?
    Jason
    http://www.k2distillery.com/
  • 09-26-2005 10:20 AM In reply to

    Re: Why is OnAfterChange firing twice?

    Thanks for the reply, Patrick. It does seem very strange to me that both of those events would raise the OnAfterChange event though. Do you know of a better way to perform the action that I'm attempting?

    vt_asparagus: check here:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/xdproOperation_2_HV01021316.asp
  • 09-29-2005 11:04 PM In reply to

    Re: Why is OnAfterChange firing twice?

    Just add a line to filter out the Delete.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.