Hi ,
find the scenario below .
<List1>
<List>
<List1>
<List1>
<List1>
</List>
<List>
<List2>
<List2>
<List2>
</List>
--
--
-
-
-
--</list1>
Here the list tag will be grow based on the I/p . Now what i want is how to get the length of <list >tag .
To implement above i used below code
var count = xfa.record.List1.List[0].nodes.length ; (Not working )
But if var count = xfa.record.List1.nodes.length ; (working )
and also i want to remove some tag inside the <List > tag . How ?
Very Urgent .
Advance thanks .
Solved! Go to Solution.
Views
Replies
Total Likes
Yes you need to use the name instead of value to get the tag name..
xfa.datsets.data.Root.nodes.item(0).name
Thanks
Srini
Views
Replies
Total Likes
In the first example you give the [] cause an issue for javascript as those are reserved for arrays. You can use the xfa.resolveNode("string") to get to your instance....something like this:
var count = xfa.resolveNode("xfa.record.List1.List[0]").nodes.length ;
Now using this syntax you can replace the occurance number with a variable and put it in a for loop:
for (i=0;i<= 10;i++){
count = xfa.resolveNode("xfa.record.List1.List[" + i + "]").nodes.length
}
Hope that helps
Paul
Views
Replies
Total Likes
while doing like belo w,
var count = xfa.resolveNode("xfa.record.List1.List[0]").nodes.length ;
the line not excuting
and if i use
var count = xfa.resolveNode("xfa.record.List1.List[0]").
then its returning value .
I hope anyone worked ealier linke this
Views
Replies
Total Likes
Just looked at a couple of Data dom manipulation forms I have done before and I use
the following code:
var currentElement;
var obj;
//Get the nodes below the root node in the dataDom
obj = xfa.datasets.data.root.nodes;
//Set an initial value for the textField
TextField1.rawValue = "The values of the coap_flag are: ";
//Loop through the nodes in the obj set
for (i=0; i< obj.length ; i++){
//set the currentElement to the 1st child node
currentElement = obj.item(i);
//Check to see if it is an applicant node
if (currentElement.name == "applicant"){
//It is an applican, now find the coap_flag node value and write it to the text field
TextField1.rawValue += "\n" + xfa.resolveNode("xfa.datasets.data.root.applicant[" + i + "]").coap_flag.value;
}
}
In all my examples I always create an object then check the length of the object. I do not know why but it does work.
Paul
Views
Replies
Total Likes
Hi .
I am not getting your answers .
Views
Replies
Total Likes
ffor E.g
<Root >
<Child>
<Nod1>
<Nod1>
</child>
<Child>
<Nod1>
<Nod1>
</child>
</Root>
Now we can use tthe above code like
xfa.datsets.data.Root.nodes
then it will return the length - 2
But now again i want to trace last node. Here <nod1> and <nod1>.
How to get the nod1 tag or how to find the length of the <child> tag .
Advance thanks .
Views
Replies
Total Likes
Try like below..
You should be able to go down one level by using nodes.item.
xfa.datsets.data.Root.nodes.item(0).value
xfa.datsets.data.Root.nodes.item(1).value
Thanks
Srini
Views
Replies
Total Likes
srini ,
can you please clear this one .
Based on tthe our scenarion ,
xfa.datsets.data.Root.nodes.item(0).value
what is the result of this code .
I need to get the child node of <child> tag .
Views
Replies
Total Likes
Hi,
xfa.datsets.data.Root.nodes.item(0).value
here instead of value should be name to get the tag name .
Thanks .
Views
Replies
Total Likes
Yes you need to use the name instead of value to get the tag name..
xfa.datsets.data.Root.nodes.item(0).name
Thanks
Srini
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies