Copy link to clipboard
Copied
I have both a name field and signature field that are to remain hidden until a field called Total has a value of 100 or greater. The Total field is calculating the sum of other fields. The code that I have does not unhide the fields the moment the Total field is 100+, only when another calculation is run thereafter. Also, if the field is unhidden and the value of Total changes to less than 100, then the field does not hide until the next calculation is executed. What am I missing?
var a = this.getField("Total");
var f = event.target;
if (a.value >= 100)
{
f.display = display.visible;
}
else if (a.value < 100)
{
f.display = display.hidden;
}
To change 'Field calculation order' you need to select 'Prepare form' tool, click on 'More' and select 'Set field calculation order' and make sure fields that should calculate first are on top of the list.
Copy link to clipboard
Copied
Try changing field calculation order.
Copy link to clipboard
Copied
Thank you, Nesa!
I have changed the field calculation order as shown below, but still left with the same problem. If I input 100 into one of the Amount fields and the Total field shows 100, it does not unhide the name and signature fields. It is only when I put a value (even 0) into another Amount field that the name and signature fields appear. It's as if it is a step behind.
var a = this.getField("Total");
var f = event.target;
if (a.value < 100)
{
f.display = display.hidden;
}
else if (a.value >= 100)
{
f.display = display.visible;
}
Copy link to clipboard
Copied
To change 'Field calculation order' you need to select 'Prepare form' tool, click on 'More' and select 'Set field calculation order' and make sure fields that should calculate first are on top of the list.
Copy link to clipboard
Copied
Thank you, Nesa! I misunderstood. When I looked at the calculation order, the hidden fields were before the Total field. It worked when I reordered them!