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

Conditional requirement field not working

New Here ,
Nov 27, 2024 Nov 27, 2024

Copy link to clipboard

Copied

Thanks in advance. I can't figure out why this isn't working. If number field "Part 3-1-Quantity" is greater than zero, then date field "Part 3-1-Expiry Date" should be required.

 

var quantity = this.getField("Part 3-1-Quantity").value;
var expiryDateField = this.getField("Part 3-1-Expiry Date");

if (quantity > 0) {
expiryDateField.required = true;
} else {
expiryDateField.required = false;
}

TOPICS
Create PDFs , General troubleshooting , How to , PDF , PDF forms

Views

137

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
1 ACCEPTED SOLUTION
Community Expert ,
Nov 27, 2024 Nov 27, 2024

Copy link to clipboard

Copied

Put it as a custom calculation script in any other text field except the two in the script.   It shouldn't be a mouse up action because the user has to enter the value then click the field.  Also, you would need to use event.target.value for the field's value.

View solution in original post

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 ,
Nov 27, 2024 Nov 27, 2024

Copy link to clipboard

Copied

It works for me.  Where do you have the script (field name and type - validation/calculation etc.)?

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
New Here ,
Nov 27, 2024 Nov 27, 2024

Copy link to clipboard

Copied

Thanks. I have it on the field "Part 3-1-Quantity", as an Action, Mouse Up, Run a Javascript.  Do i need to make the field "Part 3-1-Expiry Date" required or not required?

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 ,
Nov 27, 2024 Nov 27, 2024

Copy link to clipboard

Copied

Put it as a custom calculation script in any other text field except the two in the script.   It shouldn't be a mouse up action because the user has to enter the value then click the field.  Also, you would need to use event.target.value for the field's value.

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
New Here ,
Nov 27, 2024 Nov 27, 2024

Copy link to clipboard

Copied

LATEST

Seems to be working. Thank you!!

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