I know this may be a novice question, but can someone please explain when/why xfa.resolveNode is used form design? Is it a form of shorthand to keep from referencing a parent subform?
Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
There are a few situations when you need to resolve a node.
There are the main times you would resolve the node. There may be more, but I can't think of any at this stage.
Resolving nodes is particular to JavaScript scripts and not FormCalc scripts.
SOM stands for Scripting Object Model. XFA forms have a number of models.
In a form the top object is XFA. This stands for XML Forms Architecture.
Under this are a number of child objects in a strict hierarchy. These are referred to as DOMs or Document Object Models. There are the:
The Scripting Object Model (SOM) expressions allow you to access properties and methods.
This DRAFT form is a work in progress (I will eventually finish it): http://assure.ly/exTXaZ. The intention is to show how to build SOM expressions in different situations. At the moment it does not have any supporting text in it. Have a look at page 4 and over over the SOM expression.
I hope that helps,
Niall
Views
Replies
Total Likes
Hi,
There are a few situations when you need to resolve a node.
There are the main times you would resolve the node. There may be more, but I can't think of any at this stage.
Resolving nodes is particular to JavaScript scripts and not FormCalc scripts.
SOM stands for Scripting Object Model. XFA forms have a number of models.
In a form the top object is XFA. This stands for XML Forms Architecture.
Under this are a number of child objects in a strict hierarchy. These are referred to as DOMs or Document Object Models. There are the:
The Scripting Object Model (SOM) expressions allow you to access properties and methods.
This DRAFT form is a work in progress (I will eventually finish it): http://assure.ly/exTXaZ. The intention is to show how to build SOM expressions in different situations. At the moment it does not have any supporting text in it. Have a look at page 4 and over over the SOM expression.
I hope that helps,
Niall
Views
Replies
Total Likes
Thanks Niall! Very helpful info. I tried sending you a private email on a different subject (related toAD), but your mailbox is full. Do you have a different email address you can send me in a private msg?
Views
Replies
Total Likes
Hi,
You can catch us at http://www.assuredynamics.com.
I will try and get back to you as soon as I can, but will be out of the office a lot over the next few days.
Niall
Views
Replies
Total Likes
Niall's information is correct but I do want to add a couple of comments. resolveNode is used in two situations:
1. xfa.resolveNode is in reality a search. The search will start with the current container and work its way UP the hierarchy tree. The 1st occurance found will be returned to you. So if I did xfa.resolveNode("TextField1"). The search will start in the context of where the script is executing and look UP the tree, until it finds a TextField1 node. Note this could be an expensive operation performance wise so use it wisely.
2. The value passed to resolveNode is a string.....so when dealing with fields that have occurance number [1] or unnamed subforms #subform both of those expressions have chars in them that javascript will interpret the wrong way (i.e. brackets are used for arrays). So by using a resolveNode('Som expression") you can referece these objects direclty (no search is needed as you are pointing to the particular object). For example xfa.resolveNode("form1.Page1.subform1.Object[1]").rawValue. In this case the som expression points to the direct object and no search is required. This notation is very helpful when using a for loop and affecting many objects with the same name (they woudl use occurance numbers) as you can manipulate the sting for your needs: i.e. xfa.resolveNode("form1.page1.subform1.Object[" + i + "]").rawValue where i is a variable that is set outside the expression.
Hope that makes sense.
Paul
pguerett,
Thank you for supplying additional information. Both you and Naill have been extremely helpful.
I guess I'm not sure when I'd ever use resolveNode considering I normally always name my fields and use either Absolute or Relative referencing. I take it, people are not physically typing out the full script....i.e. xfa.resolveNode("TextField1"), but are using CTRL click or CTRL+ALT click and the resolveNode script/string is automatically added. I figure if you go the length of physically writing the resolveNode script, you might as well spend the time naming the fields and saving yourself the headache and possible performance issues.
I'm not sure how to use [" + i + "], but I know I've seen that expression before. I'll probably do some more research, unless you can provide a quick explanation.
Thanks again in advance.
Views
Replies
Total Likes
The script you mention is simple manipulation of the string. In many cases (dynamic forms in particular) when you add a row ar subform, the fields are named the same as you are simply adding a new row then you have no choice. In those cases if you want to manipulate a column of fields (lets call them TextField1 inside of a subform called Row) then using an expression like this is very useful:
for (i=0;i<=Row.instanceManager.count;i++){
xfa.resolveNode{"Row[" + i + "].TextField1").rawValue = some value
}
This for loop will lop through all of the row subforms (no matter how many you add or remove) and set the fields. Notice that we are simply manipulating the string that is being passed to resolveNode to give the syntax Row[occuranceNumber].TextField1.
Make sense?
Paul
Views
Likes
Replies
Views
Likes
Replies