Copy link to clipboard
Copied
I know this should be simple, but I'm performing the same task on several forms and I need to make sure I'm using my time as efficiently as possible.
I'm creating training checklists. Each checklist has sections of Yes/No/NA radio buttons. The trainer wants the trainee to read every section and make a choice for each item, even if the entire section doesn't apply. Rather than require 10+ N/A clicks when an entire section isn't applicable, I'm making a YES/NO radio button at the top of each section. It defaults to YES, leaving all the other radio fields in that section visible. But when no is clicked, I want all the radio buttons in that section to be hidden.
Since I will be using this same basic script several times with various object names, what's the basic Mouse Up script?
Each "Section" radio set will be Section1, Section2, etc.
Please help! Thank you!
(Acrobat Pro DC)
Copy link to clipboard
Copied
this.getField("G1Q.1").display = (event.target.value=="YES") ? display.visible : display.hidden;
this.getField("G1Q.2").display = (event.target.value=="YES") ? display.visible : display.hidden;
Copy link to clipboard
Copied
The basic code to do it is this:
this.getField("OtherFieldName").display = (event.target.value=="YES") ? display.visible : display.hidden;
You can duplicate this line for each one of the fields you want to show/hide, adjusting the field name in the quotes each time.
Copy link to clipboard
Copied
I'm sorry, I'm so new to this and I'm trying so hard to "fake it til I make it"... But Javascript just doesn't make sense to me, no matter how much "beginners research" I do. I've been troubleshooting and researching this for hours to make it work, but my brain can't wrap around it.
Would you please have mercy on me and be so kind as to break this down a little more for my old brain?
In my sample above the "Section Applicable?" YES/NO radio group is titled "Section1"
The Radio buttons below it that I want to show/hide are labeled "G1Q.1" then "G1Q.2" and so on.
What would my first Mouse up script look like for the radio group Section1 choice YES?
And what would it look like for choice NO?
Thank you so so so much!
Copy link to clipboard
Copied
this.getField("G1Q.1").display = (event.target.value=="YES") ? display.visible : display.hidden;
this.getField("G1Q.2").display = (event.target.value=="YES") ? display.visible : display.hidden;
Copy link to clipboard
Copied
I love you. Thank you my friend!! (Even though I can't speak your Javascript language!)
Copy link to clipboard
Copied
What recommendations do you have for a newbie like me to learn the basics of Javascript? I'm desperately seeking resources that will enable me to be self-sufficient and less dumbfounded.
Copy link to clipboard
Copied
General JS tutorial (note that only the core syntax applies to Acrobat): http://www.w3schools.com/js/default.asp
Homepage for Acrobat JavaScript development, including a link to the full API: http://www.adobe.com/devnet/acrobat.html
Free tutorials about Acrobat in general, including many JS related ones: https://acrobatusers.com/tutorials/
A paid-for website with tutorials about Acrobat JavaScript (not related to me): http://www.pdfscripting.com/
My humble web-site with many tools for Acrobat and Reader (mostly paid-for, some free): http://www.try67.com