I'm trying to get a text field to disappear based on a previously calculated number with Javascript for Adobe Acrobat. I want the text field to disappear only if the number in the previous field is equal to, or greater than 0, or less than 75.
I have no problems getting it to function if I only use less than 75, but when I try to introduce the range it fails.
I'm using Custom calculation script in the field that changes visibility.
This script works:
if (this.getField("PreviouslyCalculatedField").value < 75) {
event.target.display = display.hidden;
} else {
event.target.display = display.visible;
this.getField("FieldToChangeVisibility").value = "Hello world."
}
This is the script that fails:
if (this.getField("PreviouslyCalculatedField").value >= 0 && < 75) {
event.target.display = display.hidden;
} else {
event.target.display = display.visible;
this.getField("FieldToChangeVisibility").value = "Hello world."
}
It produces "Syntax Error: Invalid XML name.
Acrobat JavaScript does not have an operator to combine limits in one if
statement.
You would use this statement:
if (this.getField("PreviouslyCalculatedField").value >= 0 && this.getField("PreviouslyCalculatedField").value < 75) {
and then it would work.