W3C home > Mailing lists > Public > www-forms@w3.org > November 2006

Re: repeats

From: Jason <jeacott@hardlight.com.au>
Date: Fri, 03 Nov 2006 17:50:05 +1030
Message-ID: <454AEDA5.1000904@hardlight.com.au>
To: Lee Standen <nom@standen.id.au>, www-forms <www-forms@w3.org>

Hi Lee,
	I think thats only if you want to insert a copy from a different 
context source -at any rate its xforms 1.1, not v1.0
but it does seem to hint that the way I thought this stuff worked is the 
way they imply it does.

I should ammend my original email a little,
 >> so how should a shopping cart for example actually be built?
 >> I want:
 >> add item
 >> remove item
 >> checkout

should be:
insert item
remove item

ok order is not important in a shopping cart - but it is for many other 
uses. I'm not building ashopping cart but its the ubiquitous xforms 
example so I thought I'd go with it.

Thank you

Lee Standen wrote:
> Not sure if this works with all implementations, but see the bottom of 
> this page:
> http://skimstone.x-port.net/node/339
> Effectively, you define an origin="" attribute with an XPath to copy an 
> empty node from.
> Jason wrote:
>> Hi all, Today I decided it was time to upgrade the version of chiba 
>> I've been using for my xforms only to find that its behaviour has 
>> changed. I checked a few other implementations and they all seem to 
>> agree on this point, so I'm totally confused.
>> up until now I've been using a trigger with something like:
>>  <xforms:insert bind="bind_1" at="index('repeat_1')" position="after"/>
>> in order to allow form users to add items to lists. BUT if they remove 
>> all the items from the list then this no longer works and I apparently 
>> need a completely different button to get the first item on the list 
>> again. Is this true? My existing copy of chiba just inserts, even if 
>> there are currently no items in the list. how is this supposed to 
>> work? how have people built real life forms to cope with this odd 
>> behaviour(imho)
>> I've had another look at the w3c position for xforms 1.0 and it seems 
>> to suggest that this behaviour is designed (unless the "homogeneous 
>> collection" is actually meant to mean the collection that exists at 
>> form startup including any implied nodes from binding lazily? )
>> ref: http://www.w3.org/TR/xforms/slice9.html#action-insert
>> The homogeneous collection to be updated is determined by evaluating 
>> the Node Set Binding. If the collection is empty, the insert action 
>> has no effect.
>> The rules for selecting the index are as follows:
>> b) If the result is NaN, the insert appends to the end of the node-set.
>> c) If the resulting index is outside the valid range of the node-set, 
>> it is replaced with either 1 or the size of the node-set, whichever is 
>> closer.
>> so how should a shopping cart for example actually be built?
>> I want:
>> add item
>> remove item
>> checkout
>> I dont want an append item for the case that there are none items, and 
>> I really dont want to have to specially bother with the zero case (how 
>> is this done anyway?).
>> what am I missing?
>> much lost
>> Jason.
Received on Friday, 3 November 2006 07:42:21 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:19 UTC