Manipulate (reference) fields in script for adobe forms
Lots of developer getting confused in manipulating one field value on another field. I also suffer from this when i started learning adobe forms and adobe script. so now i found something that auto reference the fields using below trick.
Also go through To insert object reference syntax automatically: Adobe Forms
Example:
Now lets say i’m having below hierarchy,
Now i want to write script to fill Sub2 = Sub1 + 10.
Step 1) Click on txtSub2.
Step 2) Then click in script editor event, where you want to write code to fill Sub2.
Now press Ctrl key and drag mouse pointer on field in Design View, pointer icon will change to \/ icon. (v shape icon)
Step 3) Now when your mouse pointer is change, do mouse click, and reference of field will auto paste in script editor.
this way you can easily manipulate fileds in adobe forms.
Step 4). Now write below script,
Output,
Now, for Total i want Sub1 + Sub2,
Same as i expalined above,
> select Sub1 or Sub2 (one by one),
> click in script editor event,
> press Ctrl key,
> drag mouse pointer on respective field and
> do mouse click
Your final script will be,
For Mass Total, (sub1 + sub2 + total)
Final Output,
We get what we want, this may confused you, drop your query below if any.
Hope this helps.










Nice and to the point! Just a minor point to add....as a matter of good practice, when you are referencing another field on your form in script outside of your current field (ie."this"), it is good to do the following...
this.rawValue = xfa.resolveNode(somefieldname.rawValue);
xfa.resolveNode will always try to find the named node even if you do not give the exact/whole path. It makes it easier too when you have a very long path name to a field....as long as your fieldname is unique, you can simply use that name and resolveNode will "find" it for you. It is similar to JQuery methods to locate an element in a DOM for you.
But yes....nice, quick write up to the original post over in the forums!
Correct me if i'm wrong,
first the syntax is, this.rawValue = xfa.resolveNode("somefieldname").rawValue;
and trick i shown is gives you shortest possible path, so don't worry, whenever it feels it generate xfa.resolveNode syntax also (e.g. when your subform is untitled, when having array of same name control etc).
Thanks for your input. 🙂
Hope this helps.
Yes....sorry...was typing quickly and error in syntax....but the point is the same...good practice to use resolveNode to make sure it finds your element correctly in the form structure unless you are absolutely sure you are using a unique name and/or you full element path will not change.
LiveCycle ES2 * Adobe LiveCycle Designer ES2
Correct me if i'm wrong,
yes, you can wrap generated code into xfa.resolveNode if you want. but as per my understanding xfa.resolveNode will search and fieldname will point, so i preffer to point instead of serching.
Hi Prajesh,
This post is simply awesome. Thanks a lot for wonderful post. It helped me a lot.
Happy to see helpful to you. ?