[whatwg] Web Forms 2.0 comments

Ian Hickson ian at hixie.ch
Sun Jun 27 03:54:41 PDT 2004


On Sun, 27 Jun 2004, Sander wrote:
>>
>> But how often would you put user-submitted data in _template_ elements?
>
> Basically every time I'd use a template in a CMS 'generated' by a meta-CMS.

Interesting. If you are generating templates in a CMS that will then be
used to generate the final pages, though, what I would do would be to
generate the template parta with a placeholder character (U+001A) instead
of an ID (note that that character cannot ever be a legitimate character
in an HTML document). Then, search that generated string for the regexp
/\[t([0-9]+)\]/, taking note of the highest numeric match for that
embedded pattern (basically, this is searching for strings like "[t12]",
for all values of "12"). When you know the highest number that matches
that, increase it by one, and use that in the template of the ID ("t13"
or similar). Then, replace all occurances of the placeholder character
with that ID surrounded by square brackets.

It sounds complicated but it's only a few lines of code.

The case I would be more worried about is simple cases where the template
is largely fixed with just one or two attributes getting values from the
user (e.g. an <img> element's src="" attribute in the template having
its value come from the user's config).


> > You could do that by using a linear range then interpreting it as a
> > power.
>
> But that doesn't give accurate feedback to the user. (I don't seem to be
> able to quickly track down images of standard range controls for all the
> main OSes, but isn't there usually _some_ feedback on the actually selected
> value, for example through a tooltip?)

I don't think so. You can easily do something like that though:

   <input type="range" oninput="title = Math.pow(2, value)"
          min="1" max="10" ... >


> (I like the latest changes made to the repetition model, btw)

Cool.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list