Disabling an onchange event - InfoPath Dev
in

InfoPath Dev

Disabling an onchange event

Last post 01-17-2014 09:10 AM by renatois. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-27-2010 09:06 AM

    Disabling an onchange event

    Is it possible to disable the code I've written for an onchange event and then re-enable it?

    I've got a browser based form that populates a repeating table with a set of questions. The user can then select an answer from a list (Yes, No, N/A).  Yes is the default answer.  I then write the answers with the corresponding questions to a sharepoint list.  I'd like to only write back the answers that have changed.  Below is my code for determining if a change has been made.  However, it is always triggered when I write the questions to my table.  Is there a way to make it so that the Changed Event is inactive until all of the questions have been loaded the first time?

    public void gpSection2_2E_1_Changed(object sender, XmlEventArgs e)

    {

    // Get a reference to the form's XmlNamespaceManager object.

    XmlNamespaceManager ns = this.NamespaceManager;

    // See if values have been changed.

    if (e.Operation == XmlOperation.ValueChange)

    {

    e.Site.SelectSingleNode(
    "my:Updated2.1", ns).SetValue("true");

    }

    }

  • 05-27-2010 10:09 AM In reply to

    Re: Disabling an onchange event

    There isn't a way to turn an OnChange event off and on dynamically.  You can, however, add logic to the event that inspects the form's XML and only runs the relevant code only under a certain condition.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-27-2010 11:43 AM In reply to

    Re: Disabling an onchange event

    Thanks Jimmy.  That's what I decided to do and it works just fine.

  • 01-17-2014 09:10 AM In reply to

    Re: Disabling an onchange event

    Hi Jimmy, when I open a form it also loads the method of the DropDown change (public void drpChantier_Changed(object sender, XmlEventArgs e)). Can you give me a hand on avoiding that? thanks
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.