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

Using Array() to show/hide fields?

David Dunn
Registered: Oct 28 2010
Posts: 116

I have used an array of field names successfully for resetting fields and creating a table of values associated with export values. However, when set up in the following fashion the Array() approach does not work to show/hide fields. Where am I going wrong?
 
function ShowSEFields() //I have a counterpart function 'HideSEFields()'
{
var fields = new Array
fields[0] = "txtSE"
fields[1] = "cbo.SE"
fields[2] = "btn.Export.SellerEntity"
fields[3] = "btn.Copy.SellerEntityToBuyerEntity"

fields.hidden = false
}
 
PS: I always try to find the answer in the Scripting Guide and API reference before posting an inquiry.

David D

My Product Information:
Acrobat Pro 9.4, Windows
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1875
If you want to use an array to hold the field names, you;d then have to loop through the array and set the field given by the name at the current index to hidden:

// Loop through array of field name and set field to hidden
for (var i = 0; i < fields.length; i++) getField(fields[i]).hidden = true;