W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2004

[whatwg] Solution to Repetition Model Template Problem

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Sat, 26 Jun 2004 15:39:18 -0400
Message-ID: <40DDD0E6.4070107@earthlink.net>
Ian Hickson wrote:
> On Fri, 25 Jun 2004, Matthew Raymond wrote:
>>    As you may already know, there's a serious problem with the current
>>repetition system in Web Forms 2.0. The problem is that the template
>>always shows up in non-WF2 UAs.
> 
> This actually isn't a problem. You just use the template as the initial
> blank row in legacy UAs, with the "[id]" bit as the index of that row.
 > See, for instance, the example on the WHATWG site:
 >
 >    http://whatwg.org/demos/repeat-01/

    Oh yeah? Let's say that the user if viewing a list the they can 
edit.  Under the current draft, a user with a non-WF2 compliant will 
have to remove the last row if they make changes to any of the 
non-template rows that they want to submit. The server may be able to 
compensate, but if the user doesn't know that, it doesn't really matter.

>>    <template id="order"><!--
>>      <tr id="row[order]">
>>       <td><input type="text" name="row[order].product" value=""></td>
>>       <td><input type="text" name="row[order].quantity" value="1"></td>
>>      </tr>
>>    --></template>
> 
> 
> We don't want to do that because it requires allowing the <template>
> element anywhere (allowing an attribute anywhere is easy; allowing an
> element anywhere is not). Also, it wouldn't work in XML, where the
> comments can be dropped by the parser.

    Oh, I'm sure there's a way around that...

    <input template="template" type="hidden" value="
      &lt;tr id="row[order]"&gt;
        &lt;td&gt;
          &lt;input type="text" name="row[order].product" value=""&gt;
        &lt;/td&gt;
        &lt;td&gt;
          &lt;input type="text" name="row[order].quantity" value="1"&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    "/>

    Well...I'll figure it out at some point. :(
Received on Saturday, 26 June 2004 12:39:18 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:34 UTC