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

HELP with my RadioButtons & Checkboxes script

metrubio77
Registered: Jul 4 2011
Posts: 5
Answered

////the problem is that when I select the Officer RadioButton, only the RT021 checkbox is marked with "X", when I select the Reenlistment RadioButton, everything annotated is selected as it should, when I select the Enlisted RadioButton, nothing happens, all checkboxes are still empty

all 3 RadioButtons are grouped and I have enetered the script at the group level and not individaul

I believe that I missed something to actually link the script, not sure

here is the script:

---- from1.NJWPage2.RadioButtonList::change: - (JavaScript, client) ----------------------

if (Officer.rawValue == 1)
{
ISC1.rawValue = "1";
TAT1.rawValue = "1";
DD28071.rawValue = "1";
QCRE1.rawValue = "1";
RT021.rawValue = "1";
SOU1.rawValue = "1";
{
else
}
ISC1.rawValue = "0";
TAT1.rawValue = "0";
DD28071.rawValue = "0";
QCRE1.rawValue = "0";
RT021.rawValue = "0";
SOU1.rawValue = "0";
{

if (Enlisted.rawValue == 1)
{
ISC1.rawValue = "1";
TAT1.rawValue = "1";
DD28071.rawValue = "1";
QCRE1.rawValue = "1";
SOU1.rawValue = "1";
}
else
{
ISC1.rawValue = "0";
TAT1.rawValue = "0";
DD28071.rawValue = "0";
QCRE1.rawValue = "0";
SOU1.rawValue = "0";
}

if (Reenlistment.rawValue == 1)
{
ISC1.rawValue = "1";
TAT1.rawValue = "1";
DD28071.rawValue = "1";
DD28081.rawValue = "1";
DD2141.rawValue = "1";
QCRE1.rawValue = "1";
RT071.rawValue = "1";
ENLM1.rawValue = "1";
SOU1.rawValue = "1";
PRIVACYACT1.rawValue = "1";
RELM1.rawValue = "1";
DD41.rawValue = "1";
COMPWRKS1.rawValue = "1";
}
else
{
ISC1.rawValue = "0";
TAT1.rawValue = "0";
DD28071.rawValue = "0";
DD28081.rawValue = "0";
DD2141.rawValue = "0";
QCRE1.rawValue = "0";
RT071.rawValue = "0";
ENLM1.rawValue = "0";
SOU1.rawValue = "0";
PRIVACYACT1.rawValue = "0";
RELM1.rawValue = "0";
DD41.rawValue = "0";
COMPWRKS1.rawValue = "0";
}

Your help is greatly appreciated

Thank You

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
First, when you post a question you need to provide some context. We don't care one whit what the form is used for, but you do need to tell us how it works. For example, "I have a set of 3 radio buttons, when each button is pressed the values of several check boxes are set and unset. etc...".

Next, I notice that there are three distinct "if" statements that set the same values. These "if" blocks are walking on top of each other. You should have One if block that incorporates all conditions.

Next, the concept behind radio buttons is that they act together as a single control. So in concept, individual radio buttons do not have a value, the group has a value. I don't think you've setup the button values properly. You aught to be using the group name, not the button names in the "if" statements", and the value for each button needs to be different, i.e., "1", "2", "3".

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

metrubio77
Registered: Jul 4 2011
Posts: 5
Thom,

Thank you for the reply and sorry for not posting correctly, new guy here

My document does have (3) RadioButtons and about (33) CheckBoxes

I want the user to only select one RadioButton (not a problem here given that LiveCycle automatically controls for me and these RadioButtons act as a single control)

If the user selects RadioButton (Officer), then I want for an "X" in the checkbox to appear on the following CheckBoxes to let the user know that he/she will need these forms
ISC1
TAT1
DD28071
QCRE1
RT021
SOU1

If the user selects RadioButton (Enlisted), then I want for an "X" in the checkbox to appear on the following CheckBoxes to let the user know that he/she will need these forms and at the same time clear out any other "X"
ISC1
TAT1
DD28071
QCRE1
SOU1
RT071
ENLM1

And finally, If the user selects RadioButton (Reenlistment), then I want for an "X" in the checkbox to appear on the following CheckBoxes to let the user know that he/she will need these forms and at the same time clear out any other "X"
ISC1
TAT1
DD28071
DD28081
DD2141
QCRE1
RT071
ENLM1
SOU1
PRIVACYACT1
RELM1
DD41
COMPWRKS1

What exactly do you mean by this statement: "You should have One if block that incorporates all conditions"

I have made some changes, but still not working correctly

Would it be possible for me to send you the document and you take a look at it for me

Your help is greatly appreciated

Thank You


thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Read this article:
http://acrobatusers.com/tutorials/conditional-execution

Take a look at the bottom where it discusses "else if"

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

metrubio77
Registered: Jul 4 2011
Posts: 5
Thom,

Thank you for the previous post. I went into the link that you provided and made several changes to the script with no luck. Below is what I currently am working with. Any ideas

----- form1.NJWPage2.RadioButtonList::change: - (JavaScript, client) -------------------------------
if (OfficerRB.rawValue == 1)
{
ISCCB.rawValue = "1";
TATCB.rawValue = "1";
DD2807CB.rawValue = "1";
QCRECB.rawValue = "1";
RT02CB.rawValue = "1";
SOUCB.rawValue = "1";
}
else if (EnlistedRB.rawValue == 2)
{
ISCCB.rawValue = "1";
TATCB.rawValue = "1";
DD2807CB.rawValue = "1";
QCRECB.rawValue = "1";
SOUCB.rawValue = "1";
}
else if (ReenlistmentRB.rawValue == 3)
{
ISCCB.rawValue = "1";
TATCB.rawValue = "1";
DD2807CB.rawValue = "1";
DD2808CB.rawValue = "1";
DD214CB.rawValue = "1";
QCRECB.rawValue = "1";
RT07CB.rawValue = "1";
ENLMCB.rawValue = "1";
SOUCB.rawValue = "1";
PRIVACYACTCB.rawValue = "1";
RELMCB.rawValue = "1";
DD4CB.rawValue = "1";
COMPWRKSCB.rawValue = "1";
}
else
{
if (OfficerRB.rawValue == 1)
}
ISCCB.rawValue = "0";
TATCB.rawValue = "0";
DD2807CB.rawValue = "0";
QCRECB.rawValue = "0";
RT02CB.rawValue = "0";
SOUCB.rawValue = "0";
{
else if (EnlistedRB.rawValue == 2)
}
ISCCB.rawValue = "0";
TATCB.rawValue = "0";
DD2807CB.rawValue = "0";
QCRECB.rawValue = "0";
SOUCB.rawValue = "0";
{
else if (ReenlistmentRB.rawValue == 3)
}
ISCCB.rawValue = "0";
TATCB.rawValue = "0";
DD2807CB.rawValue = "0";
DD2808CB.rawValue = "0";
DD214CB.rawValue = "0";
QCRECB.rawValue = "0";
RT07CB.rawValue = "0";
ENLMCB.rawValue = "0";
SOUCB.rawValue = "0";
PRIVACYACTCB.rawValue = "0";
RELMCB.rawValue = "0";
DD4CB.rawValue = "0";
COMPWRKSCB.rawValue = "0";
{
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Accepted Answer
Have you looked in the console window to see if any errors are reported. Please see the link to the video tutorial in my signature block.

There are some obvious errors in the code you posted. You'll need to clear up all the syntax errors before you can debug the code.

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

AcrUmbi
Registered: Dec 2 2010
Posts: 18
Just a quick glance here but shouldn't you be setting the values of your checkboxes to 0 and 1, not "0" and "1" respectively?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The export value of a checkbox/radio button is a string, so that part is correct.

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