[whatwg] Solution to Repetition Model Template Problem

Matthew Raymond mattraymond at earthlink.net
Sat Jun 26 12:39:18 PDT 2004


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="
      <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>
    "/>

    Well...I'll figure it out at some point. :(



More information about the whatwg mailing list