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

Trying to use checkbox to show/hide various other fields

rbr00x
Registered: Oct 14 2009
Posts: 26
Answered

I want to use a checkbox to show/hide three combo boxes and toggle the label next to the checkbox. I am starting by just trying to get the label to switch based on whether the checkbox is selected or not.

Below is the code I have. It does not produce an error, but it does not work either. I am using Acrobat 9.0.0. Any help is appreciated!

//define checkbox variable
var cBox1 = this.getField("hideLists").value;

//determine state of checkbox
if( cBox1 == "Yes" )

this.getField("hideLabel").hidden = false;

this.getField("showLabel").hidden = true;

if( cBox != "Yes" )

this.getField("hideLabel").hidden = true;

this.getField("showLabel").hidden = false;

My Product Information:
Acrobat Pro 9.0, Windows
jimhealy
Team
Registered: Jan 2 2006
Posts: 146
I think you are just missing curly braces:
if( cBox1 == "Yes" ) { this.getField("hideLabel").hidden = false; this.getField("showLabel").hidden = true; } else { this.getField("hideLabel").hidden = true; this.getField("showLabel").hidden = false;}

Jim Healy
FormRouter, Inc.
Check out our FREE Advanced Acroform Toolset:
http://www.formrouter.com/tools

Jim Healy, Founder & CEO FormRouter Inc.
Chapter Leader AUG RTP NC
http://www.formrouter.com

rbr00x
Registered: Oct 14 2009
Posts: 26
Well don't I feel silly. I am a newbie, and since I didn't get an error without the braces I thought I didn't need them. Thank you so much!