Change value on delete item in repeating section - InfoPath Dev
in

InfoPath Dev

Change value on delete item in repeating section

Last post 01-18-2009 11:24 PM by totoen. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-16-2009 06:25 AM

    • totoen
    • Not Ranked
    • Joined on 08-11-2008
    • Posts 7

    Change value on delete item in repeating section

    Hi,

     I use infopath 2003 C#2.0.

     My problem is that I dont understand how to change a value of an attribute when I delete one of my repeating section item:

     Example:

    <Person modified="0">
    <Name>Toto</Name>
    <func>President</func>
    <func>Director</func>
    </Person>

    So now I delete the item Director. How can I do with my C# code to catch the "delete" and set "modified" attribute to 1 (in Person Element)?

     I now that I can catch the delete event in a onBeforeChange of field func with :

    if ("Delete" == e.Operation)

    But after I dont know what to do for set the value of my attribute.

    Because if I use e (eventags) I cannot go back to the parent element Person

    Any idea about how to solve this?

    Thanks

  • 01-16-2009 06:46 AM In reply to

    Re: Change value on delete item in repeating section

    Hi,

    Use the following code lines in the func field on after change event.

    if (e.Operation != "Insert")

    {

    e.Parent.selectSingleNode("@my:modified").text = "<value to be stored in modified field>";

    }

     

    Swathip
    www.ggktech.com
  • 01-16-2009 07:50 AM In reply to

    • totoen
    • Not Ranked
    • Joined on 08-11-2008
    • Posts 7

    Re: Change value on delete item in repeating section

    Thanks a lot swathip that's work.

     But can you explain me the difference between parent and parentnode because with the first that goes but not with the second?

     Cheers

  • 01-16-2009 11:18 PM In reply to

    Re: Change value on delete item in repeating section

     Hi,

    e.Parent Gets a reference to the XML Document Object Model (DOM) node of the parent of the XML DOM node being changed during a data validation event

    e.Site.parentNode gets the reference of the parent of the node for which the event is fired.

     

    Swathip
    www.ggktech.com
  • 01-18-2009 11:24 PM In reply to

    • totoen
    • Not Ranked
    • Joined on 08-11-2008
    • Posts 7

    Re: Change value on delete item in repeating section

    Hi,

     Thanks a lot for this explanation.

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