Answered
I have created an array to hold three textfield names and using a for loop I would like to make the three textfields invisible. Below is the code I am using but can't seem to get it to work.
//script object - Example1
var field_array = ["firstname", "lastname", "address"];
function SingleArray(){
for (var i = 0; i < field_array.length; i +=1) {
(field_array[i]).presence = "invisible";
}
}
In the click event of the button I have entered :
Example1.SingleArray();
Thank you in advance for helping
I think that I worked out a solution for you. The first thing you have to do is to put the array inside the function. Next there was a little trickery to get to the fields you want to turn off.
Try using this code instead in your script object
//script object - Example1
function SingleArray()
{
//the field_array variable has to be placed inside the function.
var field_array = ["firstname", "lastname", "address"];
for (var i = 0; i < field_array.length; i++)
{
/*This variable nField is the path to the field starting at the top of the form.
Your path may be longer than "form1.Page1." depending on how you
form is setup.*/
var nField = ("form1.Page1. " + field_array[i]);
xfa.resolveNode(nField).presence = "invisible";
}
}
// end function
Rick Kuhlmann
Forms Developer/Designer
Tech-Pro, Inc.
Roseville, MN