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

if calculation for tick boxes

jpcutler85
Registered: Nov 16 2009
Posts: 38

How would I go about creating this example:
 
If tick box A on page 1 is selected, then if tick box F on page 2 is selected. Go to page 15.
 
Or if field A on page 1 is filled out with a value, then if field F on page 2 is filled out with a value. Go to page 15.
 
Its purely variable, depending on what options they choose. Thanks!

My Product Information:
Acrobat Pro Extended 10.1, Windows
jpcutler85
Registered: Nov 16 2009
Posts: 38
Another option would be:

all buttons on page 1 take you to page 2 once clicked. But if you click button A on page one, after taking you to page 2 you are required to click one of the buttons on page 2. After clicking that button on page 2 it takes you to page 3.

So in a sense depending on which buttons you click on pages 1 and 2 it will take you to certain page.

*edit*

To make it simple, all check boxes could be on the same page, so if check box A and check Box B is selected it will take you to page 3. If check box A and check box C is selected it will take you to page 4 and so on. I think check boxes would be better and easier than buttons or fields.

I think in all there's about 100 different combinations


try67
Expert
Registered: Oct 30 2008
Posts: 2398
There's a difference between using buttons and check-boxes, since check-boxes maintain a value, while buttons do not. If you use buttons then you need a global variable to maintain the last state of the button. With check-boxes you can simply test their values to decide where you want to direct the user to.

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

jpcutler85
Registered: Nov 16 2009
Posts: 38
I will use tick boxes. My knowledge for writing code is minimal, how would I go about doing this?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
So let's say you have two check-boxes, "Check Box1" and "Check Box2", and you want that if "Check Box2" is ticked and "Check Box1" is already ticked, the file will move to page 15. You can enter this code as the MouseUp event of "Check Box2" to achieve that:

if (getField("Check Box1").value!="Off" && getField("Check Box2").value!="Off") this.pageNum = 14;

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

jpcutler85
Registered: Nov 16 2009
Posts: 38
Ok, Thanks for that.

I have a column of 8 check boxes for left hand side panel of a product. I also have a column of 7 check boxes for the right hand side panel. The use can mix and match each panel, and choose one option from each column. Then see the end result on a page.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
(Is that a question?)

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

jpcutler85
Registered: Nov 16 2009
Posts: 38
Sorry, I meant to ask how would I alter your code to fit within that?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You need to add the rest of the fields into the if statement:
if (a && b && c && d && e ...) { // then do this }

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

jpcutler85
Registered: Nov 16 2009
Posts: 38
Sorry, I don't know how I would add the rest of the fields.

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Just replace the name of the field between the quotes in this part:
if (getField("NAME_OF_FIELD_HERE").value!="Off" && getField("NAME_OF_OTHER_FIELD_HERE").value!="Off" && getField("NAME_OF_THIRD_FIELD_HERE").value!="Off" ... ) {}

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

jpcutler85
Registered: Nov 16 2009
Posts: 38
Then where do I define the page numbers that each combination goes to? Also how come you have value!="off" shouldn't it be "on"?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You set the page to go to with the second part of the if-statement, using the pageNum property.
"!=" means "not equal to". "Off" is the default value of a check-box when it's not ticked.

I suggest you use the Acrobat JavaScript Reference. Most of this information is available there.
Either that, or find someone to create it for you.

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

jpcutler85
Registered: Nov 16 2009
Posts: 38
Thanks for your help, I will give it a go :)