Hello,
I have this form and I would like to show/hide submit buttons on each of the form pages based on which items are checked.
So, for example:
box 1 is checked, submit2 is visible
box 2 is checked, submit3 is visible
box 3 is checked, submit4 is visible
box 1 & 2 are checked, submit3 is visible and submit2 is invisible
box 2 & 3 are checked, submit4 is visible and submit3 is invisible
etc.
I want to be able to set the variable so that if multiple boxes are checked, it goes to the last page submit button. I have no problem getting the first 3 options to work, the problem occurs when I try to do the multiple check commands.
This works to show/hide a single check box selection
if ( this.rawValue == "1" )
CommunicationServiceRequestForm.WebChatReq.Submit2.presence = "visible";
else
CommunicationServiceRequestForm.WebChatReq.Submit2.presence = "invisible";
This is what I have for scripting so far (that doesn't hide the first of the 2 submit buttons):
if (this.rawValue == 1 || EmailChk.rawValue == 0 || PhoneChk.rawValue == 0){
CommunicationServiceRequestForm.WebChatReq.Submit2.presence = "visible"; }
else {
CommunicationServiceRequestForm.WebChatReq.Submit2.presence = "invisible";}
Any insight would be greatly appreciated!
So the correct location for the script is on the submit button. In fact you can add a calculate script to a button. The calculate script is run each time any field on the form changes value.
To get your logic correct you need to rewrite the conditions as:
Submit1 is visible when ....
BTW: you don't need to use the explicit comparison to "0" and "1". These values evalutate to boolean false and true. So you can just write the code like this;
if(EmailChk || PhoneChk)
...
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