Timesheet - Validation script
Dear Community,
I wondered if you could help me.
I am trying to add a validation rule for some fields in the PDF timesheet created as a fillable form.
The employee have an option to select from 0, 0.25,0.50,0.75 and 1 day from a drop-down in the three columns:
1. Standard hours
2. Sick Day
3. Day off
What we would like to achieve is to restrict the total value of these three column to maximum 1 meaning that our employee can only claim up to 1 day for each working day regardless the column filled.
I have tried to build the validation rule with the below using the column SET with a value "1"
(function () {
var v1 = +getField("SET1").value;
var v2 = +event.value;
if (v2 > v1) {
app.alert("The total value per day must not exceed 1", 1);
event.rc = false;
}
if (v2 < v1) {
app.alert("Please assign Sickness Absence or Annual Leave for the remainder of this working day. The rest days for the part-time workers are specified in Day Off column. ", 1);
event.rc = false;
}
})();
The problem I am facing at the moment is that 25 fields in the form is validated in one go so the users gets 25 error messages before even gets a chance to select a value in the relevant field.
Could we assign a script some kind of level or priority?
Many thanks.
Veronika
[Question moved to the Acrobat JavaScript forum from the Reader forum. -Mod.]
