That's a pretty long spec that would be *really* hard to implement with JS, but definitely doable, at least to some degree.
<div><span class="gmail_quote">On 6/23/06, <b class="gmail_sendername">John Resig</b> <<a href="mailto:jeresig@gmail.com">
jeresig@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
I was thinking about this exact problem the other day. As far as
syntax goes, I'd really really like it if someone implemented the Web
Forms 2.0 specification (what will be a part of HTML 5). The spec can
be found here:
<a href="http://www.whatwg.org/specs/web-forms/current-work/">
http://www.whatwg.org/specs/web-forms/current-work/</a>If someone implemented it completely - before any browser! - we would
have a major claim to fame, along with a very cool plugin.
There's so much available in the spec, I suggest that everyone look
through it, as it looks incredibly promising.
--John
On 6/23/06, "Jörn Zaefferer" <<a href="mailto:Enchos@gmx.net">
Enchos@gmx.net</a>> wrote:
> Hi jQuery list,
>
> I had some thoughts on js powered form validation. My base idea is this:
>
> <script>
> $(#formToValidate).validate();
> </script>
>
> <form id="formToValidate" ...>
> Username: <input name="username" validate="required" .../>
> Address: <input name="address" validate="minlength#3 maxlength#25" .../>
> Stuff: <input name="stuff" validate="length#3#25" .../>
> E-Mail: <input name="email validate="email" .../>
> </form>
>
> The validate plugin would the search for all input elements (including textarea and selects), check the validate attribute and apply the given validators. The "name#parameter" syntax would allow to pass one or more parameters, eg. "minlength#3" to validate an input of at least 3 characters.
>
> I didn't write any code yet, as there are several points that bother me:
> - "validate" is no official HTML attribute. Is there any 'legal' attribute that could be used without breaking other functionality? Eg. by using the class attribute it would be easy to break styles. "rel" is only available to link- and a-tags, therefore not a good choice either. I did'nt find a good one in the XHTML specs. Any ideas?
> - How to pass error messages to the validation? Put them in the validate attribute when the page is generated (I'd prefer a multi language mechanism)? Load them via AJAX (or AHAH)?
>
> Another thing I didn't work on is outputting error messages. 'alert' is not my personal favorite. I'd definitly love to use fadeIn for error messages scrolling down from the input element :o
>
> Has anyone worked on or knows about something similar? Please let me know :-)
>
> -- Jörn
> --
>
>
> Echte DSL-Flatrate dauerhaft für 0,- Euro*!
> "Feel free" mit GMX DSL!
<a href="http://www.gmx.net/de/go/dsl">
http://www.gmx.net/de/go/dsl</a>>
> _______________________________________________
> jQuery mailing list
> <a href="mailto:discuss@jquery.com">
discuss@jquery.com</a>
> <a href="http://jquery.com/discuss/">
http://jquery.com/discuss/</a>>
--
John Resig
<a href="http://ejohn.org/">
http://ejohn.org/</a><a href="mailto:jeresig@gmail.com">
jeresig@gmail.com</a>
_______________________________________________
jQuery mailing list
<a href="mailto:discuss@jquery.com">
discuss@jquery.com</a>
<a href="http://jquery.com/discuss/">
http://jquery.com/discuss/</a></blockquote>
</div>
<br clear="all">
--
Yehuda Katz
Web Developer
(ph) 718.877.1325
(fax) 718.686.4288
_______________________________________________
jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/