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

getField on pageNum

subieguy2
Registered: Apr 30 2009
Posts: 15

Can anyone help me out with making this script turn off the fields ONLY ON THE PAGE THAT THE CALLOUT 1 FUNCTION REFERENCES?

// Function for CALLOUT 1
function callout1(){
this.gotoNamedDest('view_01'); // THIS IS THE PAGE THAT I WANT THE FIELDS HIDDEN ON
onlygrid(17); // THIS IS THE FUNCTION THAT HIDES ALL OF THE FIELDS
var Callout = "Callout 1";
var PasteFirst = "Paste 1st (Data)";
var ocgArray = this.getOCGs(this.pageNum);
for ( var i=0; i < ocgArray.length; i++) {
if ( ocgArray[i].name == Callout ) {
ocgArray[i].state = true;
}
else ocgArray[i].state = false;
}

for ( var z=0; z < ocgArray.length; z++) {
if ( ocgArray[z].name == PasteFirst ) {
ocgArray[z].state = true;
}
}
}

I'm thinking maybe there is a way to tie this...

this.gotoNamedDest('view_01');

to this....

onlygrid(17);

So it will only hide the fields at the destination view_01

Please help...last piece of my puzzle! :)

My Product Information:
Acrobat 3D 8.1.2, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
You should probably start by putting quotes around the names of your OCG's.
So this:
if ( ocgArray[i].name == Callout ) {
Should be this:
if ( ocgArray[i].name == "Callout" ) {

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

subieguy2
Registered: Apr 30 2009
Posts: 15
try67 wrote:
You should probably start by putting quotes around the names of your OCG's.
So this:
if ( ocgArray[i].name == Callout ) {
Should be this:
if ( ocgArray[i].name == "Callout" ) {
The code I posted does in fact work/function properly. The only thing it doesn't do is go to a specific page. The ocgArray you are referring to is a function I wrote to change the layer state. It works 100% the way I want.

But I still appreciate you feedback. Thanks...and keep it coming.