Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
11

Disable PDF Form field based on check box

Participant ,
Feb 08, 2024 Feb 08, 2024

First, I'm using Acrobat 9.0 Standard. (I know, I know, it's old.)  I can't afford the newer version.

 

I'm working on a medical form.   There's a question if you smoke, with check boxes Yes or No.

After that there are questions related to smoking, for example,

How many packs per day do you smoke?

How many years did you smoke?

What date did you quit smoking?

If the patient checks the NO box, can the form skip or "disable" the next 3 questions when they press the TAB key?

TOPICS
PDF forms
2.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
2 ACCEPTED SOLUTIONS
Community Expert ,
Feb 08, 2024 Feb 08, 2024

Use setFocus() to skip NO checkbox, use something like this as 'On Blur' action of YES checkbox:

 

if(event.target.value !== "Off")
this.getField("Field name").setFocus();

Change "Field name" to the name of the field where you want to set focus.

 

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2024 Feb 09, 2024

If you set it correctly, it should set focus to whatever field you put in the script.

If it doesn't work correctly for you, share your file so we can see what exactly is going on.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2024 Feb 08, 2024

Try this script (place it in the checkbox after adjusting the target field names):

if (event.target.value == "Off") {
this.getField("question1").readonly = true;
this.getField("question2").readonly = true;
this.getField("question3").readonly = true;
}
else {
this.getField("question1").readonly = false;
this.getField("question2").readonly = false;
this.getField("question3").readonly = false;
}

 

You should update your Acrobat to version 9.5 (the latest available).


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2024 Feb 08, 2024
Hi JR,
OK, thank you for your answer, but please forgive my ignorance.
 
When I right click on the "No" checkbox, and choose Properties, I get a Properties window with 4 tabs.
General - Appearance - Options - Actions
I don't get a tab for Format, which, I think is where I need to enter your Custom Format Script.
Am I wrong?
 
Also, I've tried to find Version 9.5, but have been unsuccessful.
Can you guide me for the update?
Thanks, John
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2024 Feb 08, 2024

1.

Capture_2402082141.png


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2024 Feb 08, 2024

I understand the concept.

Here is the script I tried after I modified it".

if (event.target.value == "Off") {
this.getField("Tobacco_Packs_per_day").readonly = true;
this.getField("Tobacco_years_usage").readonly = true;
this.getField("Tobacco_Quit_Date").readonly = true;
}
else {
this.getField("Tobacco_Packs_per_day").readonly = false;
this.getField("Tobacco_years_usage").readonly = false;
this.getField("Tobacco_Quit_Date").readonly = false;
}

Before the Export values were YES=0, NO=1.

Now I changed the Export Value to No on the NO check box.

But now, I can select Both check boxes, YES and NO.

Before, with 0 + 1, it would only allow me to select either YES or NO.

Also, should I change OFF in the script to match the NO check box?

Do I insert the script onto both buttons?

In other words, does the "Off" in the script need to match the Export value from the NO check box?

I'm frustrated.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2024 Feb 08, 2024

Hey JR,

After some trial and error, error, error, I think I got it working.  Thank you.

One more question.

So there are 2 check boxes,  YES  and  NO

If the patient presses the TAB key to get to the NO box, and puts in a check mark, then it skips those 3 questions, but if the the patient checks the YES box, then hits the TAB key, it takes you to the NO box.

Is there a way to have the TAB key skip over the NO box if the YES box is already checked?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2024 Feb 08, 2024

Use setFocus() to skip NO checkbox, use something like this as 'On Blur' action of YES checkbox:

 

if(event.target.value !== "Off")
this.getField("Field name").setFocus();

Change "Field name" to the name of the field where you want to set focus.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 09, 2024 Feb 09, 2024

Thanks Nesa,

But now, once I place an "X" in the YES box, the TAB key doesn't move me to any fields.

I would have liked it to bypass the NO box and jump to the first smoking question.

No what?  I think I can live without this feature.

If the patient checks the YES box and presses the TAB key,  the "cursor" moves to the NO box, then another press of the TAB key to the first smoking question because they said, YES they are a smoker.

If the patient presses the TAB key and passes the YES box and checks the NO box and presses the TAB key, it skips the next 3 smoking related questions because they said, NO they are not a smoker.

Thanks for your help. I'm going to flag this RESOLVED.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2024 Feb 09, 2024

If you set it correctly, it should set focus to whatever field you put in the script.

If it doesn't work correctly for you, share your file so we can see what exactly is going on.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 09, 2024 Feb 09, 2024

Hi Nesa,

I really appreciate you looking at this.

As you can see, I've instructed the patients to use the TAB key to move to the next field to be filled in.

On Page 3.

Have you ever used Tobacco?  YES  NO

Then there are 3 fields after that that should be skipped if the answer is NO

NEXT

Do you use any illicit drugs?  YES  NO

One field after that should be skipped if the answer is NO

NEXT

On Page 4.

History of COVID-19  YES  NO

Date field should be skipped if the answer is NO

NEXT

Cardiac Stents  YES  NO

Then there are 2 fields after that that should be skipped if the answer is NO

NEXT

Do you take any blood thinners?  YES  NO

Field after that should be skipped if the answer is NO

 

If you see anything else, feel free to let me know.

Thanks so much,

John

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2024 Feb 09, 2024
LATEST

There are 4 fields after "NO", 4th is "Alcoholic_beverages_per_week" should it skip to that field?

It already skips to that field even without script, or you want to skip to "IllIcit_Drugs_Usage"?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2024 Feb 08, 2024

2.

Click the Help menu: Check for Updates


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2024 Feb 08, 2024

When I click on Help and "Check for updates", I get this message:

No Update.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2024 Feb 09, 2024

This means that Adobe has disabled the update servers for Acrobat 9.
You'll need to download the installers to be able to install them.

Send me a private message if you want the URL.


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines