Xforms repeat setIndex inconsistent between 1.4 and 1.6

Project:formsPlayer
Version:1.4.3.1040
Component:User interface
Category:bug
Priority:critical
Assigned:abb
Status:closed
Description

Hello
Please use the attachment for your test. Unzip it and open the page capacity_trade.htm in both formsplayer 1.4 and formsplayer 1.6.

The behaviour of setIndex is not consistent between the versions.
In 1.4 only when we activate the "Add" button the second time the index (highlight) moves to the newly added entry, where as in 1.6 it works fine.
Could you let us know what needs to be done in 1.4 inorder for it to work like 1.6.

We need this although we are moving towards 1.6 our clients are still using 1.4.

I am putting the same issue on the issue list toofor your reference. Please use the attachment provided for your test.

Regards
Nirmal

The zip file has been sent to Pual Butcher.

Updates

#1 submitted by abb on Fri, 2008-06-27 00:21
Priority:normal» critical
#2 submitted by Paul Butcher on Fri, 2008-06-27 13:11
Status:new» applied

The difference is due to a difference in deferred update behaviour between the two versions. In 1.4, what is happening is that first time the action is executed, the setindex is attempting to set the index of the repeat to 2, whilst the repeat still has only one item in it (although the nodeset to which it is bound has 2 nodes). The behaviour of setindex, when given an index greater than the size of the repeat, is to set the index to the last item in the repeat (which, in this case, is also the first).

In 1.4, the action element is a boundary for deferred update. In order to see the same effect in both versions, move the setindex out of the action element, not forgetting to give it its own ev:event attribute.

<xf:setindex repeat="rtx1Sub" index="index('rtx1Sub')+1" ev:event="DOMActivate"/>

This ensures that the repeat is updated before the index is set.

Since XForms 1.1, there are certain actions, such as setindex, that force any previously deferred updates to occur, prior to execution. (see section 10, XForms Actions, for details.

#3 submitted by Anonymous on Fri, 2008-07-11 14:01
Status:applied» closed