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

Javascript - Make other fields required if a checkbox is checked

Explorer ,
Apr 02, 2020 Apr 02, 2020

Editing this post as I solved my original two problems. But I've encountered a new one. 

 

I'd like a two fields to be required only if a checkbox has been checked. One field is a text box, the other is a signature field. I don't know how to edit the Mouse Up/Mouse Down/Etc. options of the checkbox so that the other fields are required ONLY if the checkbox is checked. 

Acrobat Pro DC 2020-04-02 at 10.25.43@2x.pngexpand image

Thoughts?

TOPICS
Acrobat SDK and JavaScript
1.4K
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
Explorer ,
Apr 02, 2020 Apr 02, 2020

I've actually solved for the first scenario -- with text fields! I don't think the same validation can be applied to a signature field, though, am I right? 

Example script that would run after the first signature field has been signed: 

var bRequired = event.value != event.target.defaultValue;

this.getField("Signature2").required = bRequired;

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 ,
Apr 04, 2020 Apr 04, 2020
LATEST

Please clearly explain the specific actions you want to take place. 

 

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