Ian Bicking: the old part of his blog

Re: Repetition Javascript Library

This looks pretty interesting.

One thing I didn't quite get about this spec was : how do you work out reordering on the serverside? Do they expect the order in the POST or query string to be preserved/examined?

Maybe it needs an event so it is possible to twiddle with a hidden field on reorder or something.

Comment on Repetition Javascript Library
by rjwittams

Comments:

The spec does specify events, which this library doesn't do -- I don't understand Javascript events that much at the moment. I actually followed this post up with a post to the whatwg list where I mention this problem. Hopefully some resolution will come up for this; though as I was writing it occurred to me that it's not too hard to fix by putting in a field like this in the template:

<div repeat="template" id="foo">
  <input type="hidden" name="foo-order" value="[foo]">
  ...
</div>

Then foo-order will contain an ordered list of the indexes -- the spec specifically indicates that all attributes are substituted, not just input names. So if you don't think of index as representing order -- just some relatedness -- it's not so bad. I think this is a reasonable way to handle it, the more I think about it, and it's definitely something I can add to variable_decode (so it orders the lists for you).

# Ian Bicking