[whatwg] Interleaved repetition blocks

Ian Hickson ian at hixie.ch
Thu Jul 1 05:38:23 PDT 2004


On Thu, 1 Jul 2004, Mark Schenk wrote:
>
> These questions still apply.
>
>| A major problem this brings is the numbering of the "index" value for
>| the repetition blocks. This would have to be dynamically updated to all
>| of the same repetition blocks.

It would be a pain, if the repetition template wasn't in the same place as
the repetition blocks. But then that that works at all is largely luck.
The repetition system was never designed to cope with repetition blocks
that aren't siblings of the template.

In the simple case, where the pre-defined templates use negative values as
their index, and the only way new templates are added is via "add"
buttons, there is no problem; the template automatically increases its
index to take care of this.

In cases where it would be a problem, the author can use the relevant DOM
methods that the spec provides to do it. Since this isn't supposed to be a
supported case anyway (I have yet to see a use case, in fact), I don't
think that is too much of a burden.

Remember, this is a way of repeating form controls, not a template system!


> > This leads me to another question: why don't the index values changes
> > when moving the repetition blocks up/down? That kind of defeats the
> > purpose of the auto-numbering of the name attributes, as the order in
> > the markup will differ from the index numbering.

The purpose of the numbering is to allow controls in different blocks to
be uniquely identified. It isn't for ordering. The controls are submitted
in the order the user leaves them in at the end, which should be enough
for the server to get the order. See the demo for how to get the order:

   http://whatwg.org/demos/repeat-01/

-- 
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