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

Hiding Fields

subieguy2
Registered: Apr 30 2009
Posts: 15

OK all. I am still new to programming in JavaScript/Acrobat so I could use some help!

I am trying to get some kind of script that will check for some fields and hide others.

For example....

Say I have 4 buttons named:
Button 1, Button 2, Button 3, Button 4

When I click on Button 1 it will hide any button on that page that doesn't have a field name of Button 1.

This works by placing the code on a button. Not sure if it will at the document level.

getField("Button 1").display = display.visible;
getField("Button 2").display = display.hidden;
getField("Button 3").display = display.hidden;
getField("Button 4").display = display.hidden;

Only problem is I may have up to 130 Buttons on a document so I don't really care to write this out EVERY time for every different button selection. Doesn't seem too efficient.

Any thoughts or suggestions/help would be greatly appreciated!

My Product Information:
Acrobat 3D 8.1.2, Windows
St Peterburger
Registered: Apr 27 2009
Posts: 15
// Name buttons as Btn.1, Btn.2, Btn.3 etc.

function fHideBtns(vNumOfBtns,vDoNotHide)
{
var vBtnName="";
for (i=1; (i<=vNumOfBtns);i++)
{
vBtnName = "Btn."+i;
if (vBtnName != vDoNotHide)
this.getField(vBtnName).display = display.hidden;
};
};

// put this to btn event with correct number of buttons and current button name
// (of course you can also automate button selection, then the code will be similar for each button)

fHideBtns (15,"Btn.1");

// Hope this helps...