Copy link to clipboard
Copied
I've been searching for an answer to this for the last month, haven't had any luck, and am in desperate need of some way to make a drop down list stay inactive unless a corresponding checkbox is checked. Please note that I'm completely and totally clueless regarding JavaScript - I'm an administrative assistant, have no knowledge in even the remotest way of programming language, so my attempts to try to teach myself enough JavaScript to do this has been an utter failure.
I've created a form in Adobe Acrobat Pro X and I have multiple checkboxes in a section but there is one checkbox in particular (labelled "Advanced") that, if the user selects it, needs to activate a corresponding drop down list with sub-options (labelled "AdvancedOptions"). In my search, I've found answers/code to make a dropdown activate a checkbox but not the other way around.
I tried "hiding" the drop down until the checkbox is selected, setting the checkbox to "Show/hide a field" for the "Mouse up" action, and that works to a point. However, if the user resets the form or if they click on the checkbox accidentally and then deselect it, the dropdown is still there and is active. I need a way to ensure that selecting the checkbox activates the dropdown and deselecting the checkbox deactives/greys out the dropdown consistently and the only way that I can think of to do that is through JavaScript.
Does anyone have any ideas or can give me a script that I can copy/paste into my document and edit as needed? I would be ever so grateful!!
Copy link to clipboard
Copied
If you want it to work even when the form is cleared it's a bit tricky. Here's how I would do it...
Create a (hidden) text field and set the following code as it's custom calculation script (adjust the field names, of course):
this.getField("Dropdown1").display = (this.getField("Check Box1").value=="Off") ? display.hidden : display.visible;
That way it's the field's calculation event that is showing/hiding the drop-down, and that gets triggered even when the form is reset.
Copy link to clipboard
Copied
If you want it to work even when the form is cleared it's a bit tricky. Here's how I would do it...
Create a (hidden) text field and set the following code as it's custom calculation script (adjust the field names, of course):
this.getField("Dropdown1").display = (this.getField("Check Box1").value=="Off") ? display.hidden : display.visible;
That way it's the field's calculation event that is showing/hiding the drop-down, and that gets triggered even when the form is reset.
Copy link to clipboard
Copied
Thank you very much for that, it does help when the form is reset!
Unfortunately, it doesn't solve my issue of getting the dropdown to deactivate/hide again if the checkbox is unchecked after being initially selected. Is that possible to do without getting into some heavy programming? If not, I'll just work with this as best I can.
Thank you either way, I'm appreciative of all your help!!
Copy link to clipboard
Copied
My suggestion should have do that... If that's not working then check the JS-Console for error messages, or share the file so I can have a look at what's going on.
Copy link to clipboard
Copied
Hmm, I'm not getting any error messages and it's working insomuch as it helps reset the form when the "Clear" button is pressed. I've also discovered that I'm using Adobe Acrobat Pro 9, not X as I originally thought (I'm supposed to be upgraded and thought it had already been done), so not sure if that makes a difference??
Can I share the file directly with you? I can't find an option to do so through this message board.
It's a survey that I've been asked to create for work and I need to make a few more, so the more issues that I can get cleared up on this first one, the easier the rest will be.
Copy link to clipboard
Copied
Your Acrobat version is fine.
You can email it to me at try6767 at gmail.com, if you wish.
Copy link to clipboard
Copied
Thanks very much, just sent it to you. I really appreciate this!
Copy link to clipboard
Copied
Thank you so much for looking at this for me - it's finally working after a month of frustration and you saved my sanity!

