<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Add a row to a repeating table from javascript</title><link>https://www.infopathdev.com:443/forums/thread/21653.aspx</link><pubDate>Fri, 13 Jul 2007 14:07:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21653</guid><dc:creator>Taffman</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21653.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21653</wfw:commentRss><description>Is InvoiceDetailsRow the node name or is it InvoiceDetails and we manually add Row ?</description></item><item><title>Re: Add a row to a repeating table from javascript</title><link>https://www.infopathdev.com:443/forums/thread/3751.aspx</link><pubDate>Tue, 02 Jan 2007 21:44:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:3751</guid><dc:creator>Eric</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/3751.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=3751</wfw:commentRss><description>Thaks Matt,&lt;br /&gt;&lt;br /&gt;There's nothing inherently wrong with the snippet... it's just useless without the surrounding details.  I'm sure everyone here would benefit from a clear example if that's the best snippet to be found.&lt;br /&gt;&lt;br /&gt;I'll continue to monkey around with it when I have bunches of spare time :)&lt;br /&gt;&lt;br /&gt;thanks,&lt;br /&gt;&lt;br /&gt;-Eric&lt;br /&gt;</description></item><item><title>Re: Add a row to a repeating table from javascript</title><link>https://www.infopathdev.com:443/forums/thread/3750.aspx</link><pubDate>Tue, 02 Jan 2007 21:12:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:3750</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/3750.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=3750</wfw:commentRss><description>Hey Eric,&lt;br /&gt;&lt;br /&gt;This has been discussed several times on the forum and it seems like you have found one of the best code snippets around.  If you are having trouble adapting the code found in the post I would suggest downloading the InfoPath SDK (which can be found on a link on the left side of this page) and looking up each of the functions to determine their functionality.  After this is done, try writing your own code from scratch instead of copy + pasting.&lt;br /&gt;&lt;br /&gt;If all else fails, you can purchase support hours and we can do it for you. &lt;br /&gt;&lt;br /&lt;a target="_blank" href=http://www.qdabra.com/products.asp?cat=12&gt;http://www.qdabra.com/products.asp?cat=12&lt;/a&gt;</description></item><item><title>Add a row to a repeating table from javascript</title><link>https://www.infopathdev.com:443/forums/thread/1767.aspx</link><pubDate>Tue, 02 Jan 2007 18:17:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1767</guid><dc:creator>Eric</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1767.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1767</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;I would like to add a row to a repeating table with javascript and coudn't find any tidbits on google or in the forums.&lt;br /&gt;&lt;br /&gt;Has anyone else done this?&lt;br /&gt;&lt;br /&gt;thanks,&lt;br /&gt;&lt;br /&gt;-Eric&lt;br /&gt;&lt;br /&gt;PS I found the following but coudn't adapt it without seeing the poster's data and form layout:&lt;br /&gt;&lt;br /&gt;======================&lt;br /&gt;&lt;br /&gt;//get parent row&lt;br /&gt;var parent = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields//s1:InvoiceCommission");&lt;br /&gt;&lt;br /&gt;//get first row&lt;br /&gt;var rowOne = parent.selectSingleNode("./s1:InvoiceDetailsRow");&lt;br /&gt;&lt;br /&gt;// Create xsi:nil attribute with the proper namespace.&lt;br /&gt;var xmlNil = parent.ownerDocument.createNode(2, "xsi:nil", "http://www.w3.org/2001/XMLSchema-instance");&lt;br /&gt;xmlNil.text = "true";&lt;br /&gt;&lt;br /&gt;//clone the first row&lt;br /&gt;var rowClone = rowOne.cloneNode(true);&lt;br /&gt;&lt;br /&gt;//reset values&lt;br /&gt;var description = rowClone.selectSingleNode("s1:Description");&lt;br /&gt;description.text = "CLONED";&lt;br /&gt;rowClone.selectSingleNode("s1:IsVatCharged").text = 0;&lt;br /&gt;rowClone.selectSingleNode("s1:VatAmount").text = 0;&lt;br /&gt;&lt;br /&gt;//nillable: The order is important. Attribute must be removed when setting actual value.&lt;br /&gt;var amount = rowClone.selectSingleNode("s1:NetAmount");&lt;br /&gt;amount.text = "";&lt;br /&gt;amount.setAttributeNode(xmlNil);&lt;br /&gt;&lt;br /&gt;//append row to XML document&lt;br /&gt;parent.insertBefore(rowClone, rowOne);&lt;br /&gt;&lt;br /&gt;Your XML must ofcourse contain a "seed" row in the table, otherwise there will be nothing to clone. Do not use parent.appendChild() as this can make your XML document invalid against your XSD schema. This will happen when the XSD defines a &amp;lt;xs:sequence&amp;gt; and the row element you add is not at the very end in the schema definition.&lt;br /&gt;&lt;br /&gt;Note that MSXML does not have an .insertAfter() method. The .NET assembly System.Xml does, but this will require you to use managed code in your form, which makes deployment more complicated than a script based solution.&lt;br /&gt;&lt;br /&gt;</description></item></channel></rss>