close Warning: Can't synchronize with repository "(default)" (/project/ucw/svn does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 18 years ago

Last modified 18 years ago

#5 assigned defect

Javascript validation cleanup

Reported by: anonymous Owned by: Marco Baringer
Priority: major Milestone:
Component: component-library Version:
Keywords: form javascript validation validator Cc:


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.

Change History (2)

comment:1 Changed 18 years ago by Marco Baringer

Status: newassigned

comment:2 Changed 18 years ago by Marco Baringer

Priority: minormajor
Note: See TracTickets for help on using tickets.