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

Data "required" if data entered in another field

New Here ,
Oct 08, 2020 Oct 08, 2020

Copy link to clipboard

Copied

I have the following form scenario I need assistance solving with Javascript. 

If a user enters a serial number in one field then they are required to answer five other text fields. If no data is entered in that serial number field than those fields aren't required. 

 

Thanks Claire 

TOPICS
Create PDFs , How to , PDF forms

Views

320

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

correct answers 1 Correct answer

Community Expert , Oct 08, 2020 Oct 08, 2020

You can use this code as Custom validation or calculation script:

this.getField("Text1").required = event.value == "" ? false : true;
this.getField("Text2").required = event.value == "" ? false : true;
this.getField("Text3").required = event.value == "" ? false : true;
this.getField("Text4").required = event.value == "" ? false : true;
this.getField("Text5").required = event.value == "" ? false : true;

 

Change field names to your field names.

Votes

Translate

Translate
Community Expert ,
Oct 08, 2020 Oct 08, 2020

Copy link to clipboard

Copied

LATEST

You can use this code as Custom validation or calculation script:

this.getField("Text1").required = event.value == "" ? false : true;
this.getField("Text2").required = event.value == "" ? false : true;
this.getField("Text3").required = event.value == "" ? false : true;
this.getField("Text4").required = event.value == "" ? false : true;
this.getField("Text5").required = event.value == "" ? false : true;

 

Change field names to your field names.

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