The purpose of a form validation script is to return a boolean value ( to reference form fields, but that can lead to namespace conflicts and why make things more complicated than necessary.
If you're working with arrays of checkboxes to submit data to a server-side script then you might already have some grey hairs from trying to figure out how to validate the input using Java Script.
You can even run the validation code on the backend (if you're using Node) and show the error in the form without wiring all of the fields up manually.
By using Field Val UI to build a form and then Field Val to validate the input, you can pass the error straight back into the form.
In more complicated forms you will want to set conditions on the form that combine multiple elements.
For example, a text input that only needs to have a value if a checkbox is checked: Using simple logical operators and the functions supplied above you can do all sorts of client-side form validation.
The problem is that, to have the data submitted in a 'nice' format to the server, the function returns an array containing all the selected checkbox values. Again, we can make the code a lot simpler in supporting browsers: suffix tells a server side script such as PHP to accept multiple values with that name into an array.