On Tue, Sep 16, 2008 at 3:11 PM, Dave Newton <[EMAIL PROTECTED]> wrote: > Any more comments? > > The question has come up a few times on the user list in the last week or > two. My proposal is an incremental improvement (if tiny); if we switch to > commons-validator at least their JavaScript code could be re-used.
IMO the commons validator javascript is pretty horrible - each validator assumes there is a method named after the form which returns an array of the fields to be validated, error message and options and the validation method then goes through the returned array processing each field and validating. Its a pretty crap architecture, results in fields being evaluated by validation type (rather than their natural order) and is unuseable without something to generate the method that returns the array (which the Struts1 form tag does from memory). http://svn.apache.org/repos/asf/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/ I think at best you can salvage some code - but its far from being in a useable state. I had plans a long time ago to refactor it and produced a prototype - but never got round to finishing it and committing it back. Might be a better place to start though. Code and info available here: http://www.niallp.pwp.blueyonder.co.uk/validatorjs.html Also related Commons JIRA ticket is here: http://issues.apache.org/jira/browse/VALIDATOR-106 Probably (if you are interested) then just want to pull out the JavaScript files. Niall > Dave > > --- On Wed, 9/10/08, Dave Newton wrote: >> --- On Tue, 9/9/08, Jeromy Evans wrote: >> > I don't use S2's client-side validation myself >> as its too fragile, and >> > this improvement won't help that. (fragile as in >> its hardcoded to match >> > a theme's tag structure and breaks if a tag is >> out-of-place). >> >> I was also going to add some ids here and there, mostly for >> styling purposes, but the label-finding code would also be >> much-simplified and a tad more resilient. >> >> But the primary motivation was to allow a way of adding >> more client-side validations w/o a major undertaking. I know >> it's kinda hacky. >> >> Dave >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]