Copy link to clipboard
Copied
I have a complex 40 page PDF document with a form on each page. At top of each form/page is a 'not required' check box. Is there a way to set this so that if the user selects 'not required' they can TAB straight to next page/form without having to TAB through the form below that isn't required to be filled in?
Yes, you can use a script to set all the fields on the page as read-only when the check-box is ticked.
The basic code to do it (as the MouseUp event of the check-box) would be something like this:
var fields = ["Field1", "Field2", "Field3"]; // replace with actual field names
for (var i fields) this.getField(fields).readonly = (event.target.value!="Off");
Copy link to clipboard
Copied
Yes, you can use a script to set all the fields on the page as read-only when the check-box is ticked.
The basic code to do it (as the MouseUp event of the check-box) would be something like this:
var fields = ["Field1", "Field2", "Field3"]; // replace with actual field names
for (var i fields) this.getField(fields).readonly = (event.target.value!="Off");
Copy link to clipboard
Copied
Thank you, have tried the script but can't get it to work unfortunately. I keep getting syntax error message saying missing an ; but it is there!
Copy link to clipboard
Copied
Post your code.
Copy link to clipboard
Copied
var fields = ["Assets description 4", "Assets description 5", "Assets description 6"]; for (var i fields) this.getField(fields).readonly = (event.target.value!="Off");
I'm most likely being an idiot here sorry, do I need to fill in the other other bracket info?
Copy link to clipboard
Copied
Sorry, my bad. It needs to be:
for (var i in fields)
Copy link to clipboard
Copied
This worked! Amazing thank you!
Copy link to clipboard
Copied
Sorry to bother you again but I also have several check boxes in this section that I need to bypass as well as fields. I tried entering into your script above but they won't work (error message). Do I need to do a seperate script for this and substitute the word fields for check boxes? Thanks Kelly
Copy link to clipboard
Copied
Check-boxes are form fields, so it should work just fine.
What does the error message say, exactly?
Copy link to clipboard
Copied
That's what I thought as well. I get a SyntaxError: missing ] after element list 1: at line 2
var fields = [“Dependants 1 name", "Dependants 1 relationship", "Dependants 1 DOB", "Dependants 1 age", "Dependents 1 living at home”, "Special needs 1”]; for (var i in fields) this.getField(fields).readonly = (event.target.value!="Off");
Dependents 1 living at home' and 'special needs' are check boxes. If I delete these, the error message goes
Copy link to clipboard
Copied
You have to only use straight quotes, not curly ones. Do not edit the code in Word! Use a plain-text editor, only.
Copy link to clipboard
Copied
Check the double quotes. Use only "
Copy link to clipboard
Copied
The readOnly property only makes the fields refuse input from the user. It doesn't let the user know the field is disabled.
Here is an article and example file on giving fields a disabled look.
https://acrobatusers.com/tutorials/js_disabling_fields