#5: Javascript validation cleanup --------------------------------------------------+------------------------- Reporter: anonymous | Owner: mbaringer Type: defect | Status: new Priority: minor | Milestone: Component: component-library | Version: Keywords: form javascript validation validator | --------------------------------------------------+------------------------- The current javascript validation code in form.lisp isn't really working properly. One of the main problems I see is that since each validator has all the code generated seperately, if there are two validators the result of the second will overwrite the first one.
Proposal: Change Generate-javascript to take a field, not a field and validator. This then loops over all the validators for that field, generating the checks for all of them, if any of these fail, then apply the invalid handler for that field, otherwise apply the valid handler. The valid handler and invalid handler would also become specialized on just the field, instead of the field and validator.
Problem: If at some point we want the validators to do different things to the same field (such as error messages), then this doesn't handle it. This might be worked around by having the invalid-handler call a gather-error- messages generic function, or something along those lines.