These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Process All Fields

kplath
Registered: Jul 31 2010
Posts: 7
Answered

I've used a "process all fields" button successfully on a number of forms using this script or something similar to it:

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {
var oFields = xfa.layout.pageContent(nPageCount, "field");
var nNodesLength = oFields.length;

for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
oFields.item(nNodeCount).rawValue = ((oFields.item(nNodeCount).rawValue) * 2.54);
}
}

I would like help modifying this script so it only processes fields within a specific subform.

My thanks for any help.

Karl

My Product Information:
LiveCycle Designer, Windows
Bamboolian
Registered: Jul 27 2010
Posts: 48
Hi,

try code like following.
Just replace the "Subform1" to your subform referencing syntax.

for (var i = 0; i< Subform1.nodes.length ; i++){if (!isNaN(Subform1.nodes.item(i).rawValue)){Subform1.nodes.item(i).rawValue = Subform1.nodes.item(i).rawValue * 2.54;}}
kplath
Registered: Jul 31 2010
Posts: 7
Hey Bamboolian ... thanks a bunch ... perfect ... worked great the first time out!!!

I'm a tad new at this ... can you please tell me what the third line of your script is doing (especially the "is Non" part)? Thanks

Karl

Bamboolian
Registered: Jul 27 2010
Posts: 48
Hi kplath,

isNaN is a javascript code that checks whether value is not numeric or numeric.
(i think is abbreviation for NotaNumber or something...)

Since I saw your code is multipling the values for each object, I thought it might be better to have a check logic to determine the value in the field is a number.
kplath
Registered: Jul 31 2010
Posts: 7
Good idea, Bamboolian ... thanks again!

Karl