Email Adapter & Repeating Table in Jscript - InfoPath Dev
in

InfoPath Dev

Email Adapter & Repeating Table in Jscript

Last post 09-19-2007 09:31 AM by Greg Collins. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-18-2007 10:10 AM

    Email Adapter & Repeating Table in Jscript

    Hello,

    I have a repeating table on my form with three fields: Recipient, Task, Due Date.  For each row of the table I have a button.  When the button is clicked I want an email submit to occur with the recipient, task and due date info coming from that particular row.  Using code I found on these forums I have come up with the following code.  However, when the button from row 2 is pushed, the email adapter wants to submit the email using data from row 1.  So it does not appear to be working properly yet.  If anyone could help me out with this that would be great.

    var objEmailAdapter;

    var varTo = eventObj.Source.selectSingleNode("/my:myFields/my:group15/my:group16/my:field75").text;

    var varSubject = eventObj.Source.selectSingleNode("/my:myFields/my:group15/my:group16/my:field74").text;

    var bodyText = 'You have a new Action Item:\n';

    var bodyDue = '\n\nDue Date:\n';

    var varIntro = eventObj.Source.selectSingleNode("/my:myFields/my:group15/my:group16/my:field74").text;

    var varDue = eventObj.Source.selectSingleNode("/my:myFields/my:group15/my:group16/my:field68").text;

    objEmailAdapter = XDocument.DataAdapters("Email Submit");

    objEmailAdapter.To = varTo;

    objEmailAdapter.Intro = bodyText + varIntro + bodyDue + varDue; objEmailAdapter.Subject = varSubject.text;

    objEmailAdapter.Submit();

     

  • 09-19-2007 09:31 AM In reply to

    Re: Email Adapter & Repeating Table in Jscript

    The problem is your select code. Your absolute XPath is saying to go back to the root node, then find the field.... If you follow the logic of your XPath, you will see that it will of course always select the first row. It has no other choice.

    The trick here is that eventObj.Source points to the row that the button is located on. So you only need to use a relative XPath from here.

    Assuming that my:group16 is your repeating node in your DOM... then that would be what the eventObj.Source points to, and you would only need a select stament like this:

    var varTo = eventObj.Source.selectSingleNode("my:field75").text;

    Hope that helps!

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