Rules
Checks between fields
A café cannot have more women on staff than it has staff. Each answer is fine alone; only the two together can be wrong.
checks on a field compare its answer with another field in the same section, named by its key:
checks: [{ atMost: "total_staff" }],
Add the check to the number of women:
{
key: "female_staff",
type: "number",
min: 0,
label: "Women on staff",
checks: [{ atMost: "total_staff" }],
},
Enter 5 staff and 7 women, then leave the field: it says Must be at most staff, written from the other field's label. The check waits while either answer is blank.
The words are equals, atMost, atLeast, lessThan and moreThan. Put a check on the field whose error should show. { sum: ["women", "men"] } compares with a total, and message replaces the words.