Changing Node Values - InfoPath Dev
in

InfoPath Dev

Changing Node Values

Last post 12-11-2008 11:56 AM by ACrush. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-17-2006 07:23 PM

    • delu
    • Not Ranked
    • Joined on 01-12-2006
    • Posts 13

    Changing Node Values

    How can I change the value of a text box within my document?

    When I do the following:

    IXMLDOMNode nNextAction = thisXDocument.DOM.selectSingleNode("my:myFields/my:NextAction");
    nNextAction.text = "blah";

    then the value does not stay changed when the document is stored/submitted.

    When I do:


    nNextAction.nodeValue = "Review";

    then I get a security exception :-/
  • 01-17-2006 08:07 PM In reply to

    You probably need to remove the xsi:nil attribute. I use this helper function:


    IXMLDOMNode nNextAction = thisXDocument.DOM.selectSingleNode("my:myFields/my:NextAction");
    removeNil(nNextAction).text = "blah";

    public IXMLDOMNode removeNil(IXMLDOMNode n)
    {
    //Determine whether the xsi:nil attribute is set for this
    //element. If so, remove the xsi:nil attributes so that
    //the value can be set.
    if (n.selectSingleNode( "@xsi:nil" ) != null)
    n.selectSingleNode( "@xsi:nil" ).text = "false";

    // return the node for convenience
    return n;
    }


    Hope this helps!

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 12-11-2008 11:56 AM In reply to

    OK, but when you have to remove or reapply the xsi:nil attribute in a Changing event handler, the Changing event fires the other time. Is there anything like DisableEventFiring around to help with that?

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.