[whatwg] WF2 Repitition Model

Greetings,

I think I missed something important, why is a template element is bad?

To me, using a template element makes more sense than using a template attribute.

In my little world, this template:

<template for="profile" repeat-min="3" repeat-max="10">
        <fieldset>
        <legend>Member Profile</legend>
                <p>Name: <input type="text" name="profile[][name]" value=""></p>
                <p>Email: <input type="email" name="profile[][email]" value=""></p>
                <p>Signature:<br><textarea name="profile[][signature]" value=""></textarea></p>
        </fieldset>
</template>

yeilds ->

        <fieldset>
        <legend>Member Profile</legend>
                <p>Name: <input type="text" name="profile[0][name]" value=""></p>
                <p>Email: <input type="email" name="profile[0][email]" value=""></p>
                <p>Signature:<br><textarea name="profile[0][signature]" value=""></textarea></p>
        </fieldset>
        <fieldset>
                <legend>Member Profile</legend>
                <p>Name: <input type="text" name="profile[1][name]" value=""></p>
                <p>Email: <input type="email" name="profile[1][email]" value=""></p>
                <p>Signature:<br><textarea name="profile[1][signature]" value=""></textarea></p>
        </fieldset>
        <fieldset>
                <legend>Member Profile</legend>
                <p>Name: <input type="text" name="profile[2][name]" value=""></p>
                <p>Email: <input type="email" name="profile[2][email]" value=""></p>
                <p>Signature:<br><textarea name="profile[2][signature]" value=""></textarea></p>
        </fieldset>

Of course this can get a bit ugly. ;-)

<template for="genus">
                <p>Genus: <input type="text" name="genus[][name]" value=""></p>
        <template for="species">
                <p>Species: <input type="text" name="genus[][species][][name]" value=""></p>
        <template for="sub">
                <p>Sub: <input type="text" name="genus[][species][][sub][][name]" value=""></p>
        </template>
        </template>
</template>

The templates above don't break my server-side scripts. ;-)

Michael 'Ratt' Iannarelli

Received on Sunday, 27 June 2004 08:38:16 UTC