W3C home > Mailing lists > Public > www-style@w3.org > March 2012

Re: New feature. Content templates

From: Alexander Shpack <shadowkin@gmail.com>
Date: Fri, 16 Mar 2012 00:37:48 +0200
Message-ID: <CAK4xKXnvpmJb+ooBe9ZKybo-e9W3Y3Pm+-V=ZZgrTbJx7XUAKA@mail.gmail.com>
To: Jerome Leclanche <adys.wh@gmail.com>
Cc: Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com>, www-style <www-style@w3.org>
> That's an interesting idea. I'd use text() rather than pattern() though.

Pattern may contain not text only.

>
> A real world example could be a text preview of a form/email being sent...
> something that needs its content to be updated live. Maybe one of those
> "fill-a-word" forms.
> This can all be done in easy and simple javascript though, so I don't
> actually see much *use* for it, but I still think it's an excellent idea.
>

Another example: Error messages near invalid inputs or boxes.

Basic HTML

<label class="handleEmptyErr"> Login <input type="text"></label>
<label class="handleEmptyErr"> Pass <input type="password"></label>
<label class="handleEmptyErr handleMatchErr"> Pass again <input
type="password"></label>

Basic CSS

.handleEmptyErr::after
{
 content: pattern(emptyErrMsg);
}
.handleMatchErr::after
{
 content: pattern(matchErrMsg);
}

When user sent this form via AJAH, in error case server should
response just patterns

<div style="display:none" id="response">
 <div id="emptyErrMsg"><span class="errMsg">This field is required</span></div>
 <div id="matchErrMsg"><span class="errMsg">Doesn't match</span></div>
</div>

And, if I need to clear error messages, I just remove #response container.

Voila!
Received on Thursday, 15 March 2012 22:38:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:48:52 GMT