Skip to main content
Participating Frequently
May 24, 2019
Answered

How do you disable fields in PDF form?

  • May 24, 2019
  • 2 replies
  • 18287 views

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?

This topic has been closed for replies.
Correct answer try67

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");

2 replies

Thom Parker
Community Expert
May 28, 2019

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

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
try67Correct answer
Community Expert
May 24, 2019

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");

Participating Frequently
May 24, 2019

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!

try67
Community Expert
May 24, 2019

Post your code.