Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to programatically set values for the repeating table

1 view
Skip to first unread message

jp

unread,
Mar 2, 2005, 12:38:17 AM3/2/05
to
Hi

How I can add values for first row of empty repeating table by using
jscript?
Button where "add_text" function is attached is outside of table.

Data source:
myFields
group1
group2 (repeating table)
field1
field2
fileld3


Best Regards
Juha


Greg Collins [InfoPath MVP]

unread,
Mar 4, 2005, 7:01:59 PM3/4/05
to
var oRow = XDocument.DOM.selectSingleNode("my:myFields/my:group1/my:group2[1]");
oRow.selectSingleNode("my:field1").text = "Some Value";
oRow.selectSingleNode("my:field2").text = "Some Other Value";
oRow.selectSingleNode("my:field3").text = "Yet Some Other Value";

The "[1]" specifies to get the first instance of group2. If you said "[3]" then you would get the 3rd row (if it exists).


If a row might not exist, you can use error checking like such:

var oRow = XDocument.DOM.selectSingleNode("my:myFields/my:group1/my:group2[1]");
if(null != oRow)
{
oRow.selectSingleNode("my:field1").text = "Some Value";
oRow.selectSingleNode("my:field2").text = "Some Other Value";
oRow.selectSingleNode("my:field3").text = "Yet Some Other Value";
}

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com

"jp" <juh...@yahoo.com> wrote in message news:4225514c$0$30231$39db...@news.song.fi...

0 new messages