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

Check Box Help

liro0917
Registered: Nov 14 2008
Posts: 2

I have an Active form with check boxes. There are 3 potential actions that the person entering can choose from they need to be required to check at least one box before going to the next question. Can this be done? Also I don't know why this is happening but when i put a check in one box it is making a check down a whole row. How can I stop that?

Thanks!

liro

My Product Information:
Acrobat Pro 9.0, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
If you've given your check boxes the same name and each has the same export value, you will get the behavior you're seeing. To prevent it, give each check box a different export value.

To prevent the next question(s) from being activated, you will have to use some JavaScript the controls the visibility and/or read-only status of the subsequent fields. The JavaScript would be triggered when check box is checked/unchecked. It's difficult to suggest specific code without knowing more about your form. You also have to decide what should happen if a user goes back and unchecks a check box so that none in the group is selected.

BTW, did you create the form in Acrobat or LiveCycle Designer?

George
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Form fields are identified by thier names. In Acrobat (not LiveCycle) if two fields have the same name they are the same field. make sure that you give each of your check boxes different names. Do not use spaces or special characters in the names.

It is possible to force a kind of validation on a group of check boxes. To do this you first have to name the checkboxes as a group using the dot notation. For example, these names would put 3 different checkboxes into the same group.

Q1.Check1, Q1.Check2, and Q1.Check3

The code for doing the check is relativly simple:
var flds = this.getField("Q1").getArray();var bChecked = false;for(var i=0;i<flds.length;i++){if(bChecked = flds[i].isBoxChecked(0))break;} if(!bChecked)app.alert("Must Select at least one check box");

The problem is where do you put the code. The best place would be in a script that is run just before the document is submitted. You could check all the fields here and then block submission if anything is wrong. There are lots of other possibilities, but they all tend to be a bit awkward. You'll have to decide how you want the form to work, and that will determine which event scrpit to use.

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/]http://www.adobe.com/devnet/acrobat/[/url]

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

RLK
Registered: Nov 20 2008
Posts: 4
I'm trying to set up my check boxes to only allow the user to select one of 2 check boxes. There is Yes and No and users are able to select both of these options. I want to make the Form so that when you select Yes, you can't select No or vice versa.

Thanks
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
RLK,

You need to give both check boxes the same name but different export values.

George