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

Javascript - Make other fields required if a checkbox is checked

Explorer ,
Apr 02, 2020 Apr 02, 2020

Copy link to clipboard

Copied

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.png

Thoughts?

TOPICS
Acrobat SDK and JavaScript

Views

943

Translate

Translate

Report

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

Copy link to clipboard

Copied

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;

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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