get a correct row OnAfterChange Event in a repeating section - InfoPath Dev
in

InfoPath Dev

get a correct row OnAfterChange Event in a repeating section

Last post 10-24-2008 01:00 PM by Hilary Stoupa. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 10-23-2008 12:49 PM

    get a correct row OnAfterChange Event in a repeating section

     I have a question, how do I get a correct row OnAfterChange event in a repeating section using JScript.  The only way I can seem to manipulate it is by using position() methode, but I don't know what position it is.

     Thanks a lot.

  • 10-23-2008 01:35 PM In reply to

    Re: get a correct row OnAfterChange Event in a repeating section

    Hi--

    Your On After Change has an argument that is a DataDOMEvent called 'eventObj'. This refers to the changing node -- in your case, a repeating section. eventObj.Site.selectSingleNode("my:field1").text for example, would give me the value of the field named 'my:field1' inside a repeating section or table. Let me know if you need more information or explanation.

    Hilary Stoupa

  • 10-23-2008 02:13 PM In reply to

    Re: get a correct row OnAfterChange Event in a repeating section

    Thank you for the reply,

    For some reason when I do that, I still always get the first row no matter what.

    Thank you.

  • 10-23-2008 02:43 PM In reply to

    Re: get a correct row OnAfterChange Event in a repeating section

    Hmm. That's odd. I don't -- I get each row as I change it. Can you paste in your script so I can try it?

    Hilary Stoupa

  • 10-23-2008 10:50 PM In reply to

    Re: get a correct row OnAfterChange Event in a repeating section

    Hi,

    If you want to get the specific row in a repeating section .Then please follow the below code lines . I hope this will help you.

    eventObj.Site.selectSingleNode(Xpath[Row Number]).

    Xpath - Xpath of the corresponding row.

    Row Number - specify the row number which you want to get.

     If it is not the correct fix for your solution, please let me know the clearly about your problem.

    Chandrakanth/GGKTech
  • 10-24-2008 10:17 AM In reply to

    Re: get a correct row OnAfterChange Event in a repeating section

    My observations agree with Hilary's.  eventObj.Site should be the node of the new row.  Please make sure that your code is in the OnAfterChange event of the repeating group itself, not on the parent of the repeating group.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-24-2008 12:45 PM In reply to

    Re: get a correct row OnAfterChange Event in a repeating section

     Thanks for the help I am new to infopath.

    just for the example:

     I am trying to do something as simple as printing out a value of the control that I am changing and its always the first element of the repeating section even if I am changing the 2nd or 3rd.

    function msoxd__class_attr::OnAfterChange(eventObj) {

     XDocument.UI.Alert(eventObj.Site.selectSingleNode(/head/body/control/@class").text);

    }

     Thanks

  • 10-24-2008 01:00 PM In reply to

    Re: get a correct row OnAfterChange Event in a repeating section

    Ah, okay. See your XPath? you are going all the way back to the root of your XML, I bet. And your function? Is @class the repeating field? if so, you should be able to just use eventObj.Site.NewValue.text to get the current value.

    If, for example, 'control' were your repeating group, and you had an OnAfterChange event attached to it, you would use eventObj.Site.selectSingleNode("@class") to get the correct class attribute for each instance of the control node when it changes... does that make sense?

    Hilary Stoupa

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