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;
}
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.
Copy link to clipboard
Copied
It works for me. Where do you have the script (field name and type - validation/calculation etc.)?
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?
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.
Copy link to clipboard
Copied
Seems to be working. Thank you!!