> Brian schrieb:
>> After checking the W3C spec, it doesn't say much about what is and isn't
>> legal in a class in HTML.  It simply says that it's a CDATA.  But, the
>> examples in the spec doc do allow hyphens.  I'd be cautious about what
>> characters I use in a class, because CSS is stricter about what may be
>> in
>> a selector than HTML itself is, and it would be a Good Thing to be able
>> to
>> style by validation mask.
>>
> The validation plugin uses $v(...) as a default to hide validation rules
> from stylesheets. But as you can override that via an option, that would
> be no problem either. Just setup the validation options like this:
> var options = {
>     rulesClassStart: "",
>     rulesClassEnd: "",
>     rulesDelimiter: " ",
>     // other options
> };
>
> That would allow you to define your validation like this:
> <input class="required pattern:###-###-##" />
>
> Obviously, it wouldn't allow you to use 'pattern' as a style class. In
> that case, you should just seperate styles and validations.

Well, it looks like Joern more or less has it covered.  I'd simply use
something like { rulesClassStart: "val-", rulesClassEnd: "";
rulesDelimiter: " " }.

He also mentions (in another email) that using <label> to semantically
separate the validations from the inputs can be done with relatively small
modifications to his existing plugin.  Worth looking into.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to