Copy link to clipboard
Copied
My understanding is that custom validation scripts only run when a field is changed.
I am writing a script to validate a date. The script runs only when the field changes (as expected). It is working fine except that it seems to get the value of the field BEFORE the change, not after, and that doesn't do me much good.
Obviously I'm missing something. Any help would be appreciated.
Jack
The value of the field does not change until after the validation script has been run. So, inside the validation script you cannot use "getField" to get the value of the field on which the validation script is attached.
Instead, everything about the field that is changing is in the "event" object.
For example, the newly entered value is in "event.value"
Here's the reference entery:
Copy link to clipboard
Copied
What script does you use?
Copy link to clipboard
Copied
f1=getField("Date Business Started - Month")
f2=getField("Date Business Started - Day")
f3=getField("Date Business Started - Year")
day=f2.value
app.alert("Day is: "+day)
Copy link to clipboard
Copied
The value of the field does not change until after the validation script has been run. So, inside the validation script you cannot use "getField" to get the value of the field on which the validation script is attached.
Instead, everything about the field that is changing is in the "event" object.
For example, the newly entered value is in "event.value"
Here's the reference entery:
Copy link to clipboard
Copied
Yes, that makes sense, and it works. I will have to change my approach a bit, but that's a minor problem.
Thank you for your assistance.