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

Hide pages javascript needed

sbronson
Registered: Mar 12 2010
Posts: 2

I have a 3 page pdf form that has 2 check boxes named doc 1 and doc 2. If those check boxes are FALSE, I need certain pages hidden from view & print.

Can someone send me exactly what I need to paste into the javascript box for the Run Javascript action on my button please?

The form is on our intranet so users can select the pages they need to fill in and print.

Thank you in advance for your help!!!

My Product Information:
Acrobat Pro Extended 9.2, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You can't hide a page with JavaScript. You can delete it, though.

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

UVSAR
Online
Expert
Registered: Oct 29 2008
Posts: 1357
.. but if you allow them to delete a page and they press SAVE, you lose your original!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
If the PDF is displayed in Reader then you can't delete it anyway.

Also it's not quite true than you can't hide a page. If the page is marked as a template it can be hidden and shown from a document level script, but only in Acrobat Pro/Standard. Page Templates can be created from the "Advanced > Document Processing > Page Templates..." menu item.But the most effective way to make a form with dynamic pages is with LiveCycle Designer. In a dynamic form a page can be hidden and shown with a document script in both Pro and Reader.

Convert your PDF to dynamic LiveCyle form and then watch this video:
https://admin.adobe.acrobat.com/_a200985228/p87746471/

All will be revealed!

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Dan_B
Registered: Jul 14 2010
Posts: 3
Hi Thom,

I've been following your video (which is great btw)

I'm very stuck on the IF Statement to disappear the Field1 box. I think the IF statement is incorrect: This is what i have:


form1.P1.SHField1::change - (JavaScript, client)

If(this.rawValue == 1)
Field1.presence = "visible";
Else
Field1.presence = "invisible";

The form is saved as Dynamic as if I remove the IF part I can simply change the property if Field1 and it works.

Do i need to convert the rawValue to a number ? or something different IF steps don't work also.!!

Thanks
Dan
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Check the syntax of you 'if' statement, be very careful with the capitalization of your text.

George Kaiser

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, the "I" in "if" and the "E" in "else" should not be upper case.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Dan_B
Registered: Jul 14 2010
Posts: 3
Wow... :0) Oops (New to 'code writing' and it shows.)

Thank You so much Gentlemen... I'm learning to love LiveCycle Designer :0)

Your videos are super!