Expand my Community achievements bar.

Recursive Function

Avatar

Former Community Member
Hi there,



i am writing a recursive function to iterate through the subforms of the form.but i am facing certain problems such as

what should be the exit condition & how do i determine it??



could you please help me with it.



thanks for your time & awaiting a reply!!
2 Replies

Avatar

Former Community Member
The Tab and Enter keys both trigger the exit event, but if you could be more specific it would be easier to help you.



Regards,

Dave

Avatar

Level 6
Here's a recursive function that puts the names of all subforms into the field called TextField1. To get all subforms on the form, call it using getSubNames(xfa.form.nodes). Hope this helps.<br /><br />Jared Langdon<br />http://www.jlangdon.ca<br /><br />function getSubNames(oNodeList) {<br /> var nNumberOfNodes = oNodeList.length;<br /> for (var i=0; i<nNumberOfNodes; i++) {<br /> if (oNodeList.item(i).className == "subform") {<br /> TextField1.rawValue += oNodeList.item(i).name + ";";<br /> getSubNames(oNodeList.item(i).nodes);<br /> }<br /> }<br />}