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

How are index and focus connected?

From: David Landwehr <david.landwehr@solidapp.com>
Date: Tue, 28 Mar 2006 11:40:57 +0200
Message-ID: <442904A9.2080503@solidapp.com>
To: www-forms@w3.org, www-forms-editor@w3.org
Dear Working Group,

How is the repeat-index connected to the focus handling? The 
specification does not mention anything about what happens with the 
focus when the index is moved and it seems to me that there should be a 
link between focus and index.

One example is the following:
<xforms:instance>
  <data xmlns="">
    <row>r1</row>
    <row>r2</row>
    <row>r3</row>
  </data>
</xforms:instance>

<xforms:repeat nodeset="row" id="repeat">
  <xforms:input ref=".">
    <xforms:label>Row:</xforms:label>
  </xforms:input>
  <xforms:trigger>
    <xforms:label>Insert</xforms:label>
    <xforms:action ev:event="DOMActivate">
      <xforms:insert nodeset="../row"  position="after" 
at="index('repeat')"/>
      <xforms:setvalue ref="../row[index('repeat')]" 
value="concat('r',count(../row))"/>
    </xforms:action>
  </xforms:trigger>
</xforms:repeat>

So the question is that if you click on the row containing r2 the 
instance will have the elements with the values, {r1,r2,r4,r3}, the 
index will be 3 because if was adjusted as a consequence of the insert. 
Now clicking on the r2 again what will the instance look like in that 
case, [1] {r1,r2,r5,r4,r3} or [2] {r1,r2,r4,r5,r3}. The [1] scenario 
will arise either if the index is moved before each user interaction or 
if changing the index also move the focus. Scenario [2] will occur when 
the focus does not change when the index is moved and since the trigger 
for r2 had focus from the first click the index is never moved, e.g. the 
index is the following row in the repeat.

Attached is a working testcase which btw. give different results between 
implementations (of the processors tested only the Novell IE-plugin 
adjusted the index immediately after the insertion). Which leads to a 
more general question about when the index must be adjusted (e.g. does 
deferred updates have an impact)?

Best regards,
David

-- 
--------------------------------------------
David Landwehr (david.landwehr@solidapp.com)
Chief Executive Officer, SolidApp
Web: http://www.solidapp.com
Office: +45 48268212
Mobile: +45 24275518
--------------------------------------------



Received on Tuesday, 28 March 2006 09:41:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:03 GMT