I found this old class.  This was one of the first things I ever made with 
MooTools (and JavaScript.)  It's surprisingly not completely horrible :)

http://jsfiddle.net/rpflorence/cn8a2/

It posts the form with JSON, then if it finds an 'error' key in the json it 
runs through that to find all the elements with errors and provides a message.  
Otherwise fires a validate event.

On Oct 14, 2010, at 11:32 AM, Aaron Newton wrote:

> Sorry to chime in rather late here; was out of town.
> 
> Cheap one:  I see the default error behavior I get with
> Form.Validator.Inline.  It's nice, but I was wondering if there was a
> catalog out there somewhere of other ways to handle the error
> messages.  For example, I'd really like to have the error message
> appear inside the <label> tag, but I'm trying to be lazy and not write
> my own...<ducks>.
> 
> If you look at Form.Validator.Inline you'll see that there's not a ton of 
> code. Further, if you extended THAT class you could easily overwrite how it 
> injects feedback into the DOM.
>  
> More in-depth one:  So client-side validation is nice, but obviously,
> you still need to validate data on the server, and you still need to
> be able to return errors from the server back to the client if you hit
> errors.  So, from that perspective, the only thing that client-side
> validation really wins you is less of a server load, and maybe a nicer
> experience for the end user.
> 
> The slick thing to do would be to somehow integrate error messages
> spit back by the server with error messages from Form.Validator.  I'm
> not 100% sure what the behavior should be like, but in a general way,
> I'd imagine that the server would return <div class="validation-
> advice"> tags that somehow Form.Validator would pick up, and then
> appropriately display (and then appropriately remove, if/when the user
> inputs data in the proper format).  I guess my question is...does this
> kind of integration exist?  How do other folks handle this sort of
> thing?
> 
> There is not, though I've often found myself contemplating it. I don't think 
> it would be all that hard, but I've never had time for it. In theory the 
> clientside validation should prevent an invalid form from being submitted, so 
> the server errors are never visible...

Reply via email to