Fixing a form validity issue

Whether the form should submit is not just due to the element’s
validity, it also depends on the per-element logic of whether the
element should return.  Including a function to test this validity
before the form submits.