I want to validate a table of percentages which must add up to 100.
If I put my validation rule on the last option, it does not trigger if the applicant chooses a zero-value (empty).
If I put my validation rule on all the options, it triggers every time I change a value, and fails validation while the applicant is filling.
How do I display a warning only at the end, but prohibit navigation on page change?
Wrap all your decimal fields in a block and put the validation rule on the block. Error message will appear at bottom of block, below all fields. I tested with three fields and the following validation rule on the block, seems to meet your requirements:
+data.percentA + +data.percentB + +data.percentC === 100 || "These must add up to be 100"
My failure tests work fine, but this won't pass validation under any circumstance.
Sorry, have to vote down.
Also, double plusses seem to cause syntax errors in the linter.
Seems the double plusses are mandatory to make this script function. Ignored the linter warning, and it works fine.