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

If textbox contains text, checkbox is marked

Explorer ,
Oct 21, 2025 Oct 21, 2025

I would like to make sure that whenever I type anything into that first box (John Smith) that the corresponding checkbox (black circle) automatically marks itself, and when the John Smith box is empty, the checkbox returns to its normal state.

 

symone_1736_1-1761068605053.png

 

Thanks!

TOPICS
Edit and convert PDFs , How to , JavaScript , PDF , PDF forms
123
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 ,
Oct 21, 2025 Oct 21, 2025

Enter the following custom calculation script in the text field:

if(event.value){this.getField("Check Box1").checkThisBox(0,true)}
else
{this.getField("Check Box1").checkThisBox(0,false)}

Change the name of the check box in the script to the actual name.  You should also make the check box field read only so the user can't manually change it.

 

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 ,
Oct 21, 2025 Oct 21, 2025
LATEST

This type of feature requires a script, which requires knowing the name of the checkbox field.  

I'll assume the name of the checkbox field is "NameCheck". 

Add this script to the Custom Validation script on the "John Smith" field.

this.getField("NameCheck").checkThisBox(!/^\s*$/.test(event.value),0);
Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Oct 21, 2025 Oct 21, 2025

Enter the following custom calculation script in the text field:

if(event.value){this.getField("Check Box1").checkThisBox(0,true)}
else
{this.getField("Check Box1").checkThisBox(0,false)}

Change the name of the check box in the script to the actual name.  You should also make the check box field read only so the user can't manually change it.

 

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 ,
Oct 21, 2025 Oct 21, 2025
LATEST

This type of feature requires a script, which requires knowing the name of the checkbox field.  

I'll assume the name of the checkbox field is "NameCheck". 

Add this script to the Custom Validation script on the "John Smith" field.

this.getField("NameCheck").checkThisBox(!/^\s*$/.test(event.value),0);
Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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