Highlighted

Data "required" if data entered in another field

New Here ,
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 

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.

TOPICS
Create PDFs, How to, PDF forms

Views

24

Likes

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

Data "required" if data entered in another field

New Here ,
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 

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.

TOPICS
Create PDFs, How to, PDF forms

Views

25

Likes

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
Oct 08, 2020 0
Engaged ,
Oct 08, 2020

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...
Oct 08, 2020 1