Strange ordering of xforms:select results

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange ordering of xforms:select results

Wouter Zelle
Hi guys,

I get very weird behaviour with a very basic xforms:select, like this one:

<xforms:select appearance="full" ref="choice">
    <xforms:label>Choice</xforms:label>
    <xforms:item>
        <xforms:label>Option 1</xforms:label>
        <xforms:value>option1</xforms:value>
    </xforms:item>
    <xforms:item>
        <xforms:label>Option 2</xforms:label>
        <xforms:value>option2</xforms:value>
    </xforms:item>
    <xforms:item>
        <xforms:label>Option 3</xforms:label>
        <xforms:value>option3</xforms:value>
    </xforms:item>
    <xforms:item>
        <xforms:label>Option 4</xforms:label>
        <xforms:value>option4</xforms:value>
    </xforms:item>
</xforms:select>

Now if I check off all options, the values in the main instance are:

<choice>option2 option3 option1 option4</choice>

My testing shows that this ordering is completely predictable, no matter in what order I check off options or the number of options that are selected. Obviously I want to output the values in the same order in which there are shown while editing, but this cannot be done easily with this weird ordering. Is there a bug that misplaces the value for the fir
st xforms:item?

Regards,

Wouter Zelle


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Strange ordering of xforms:select results

Alessandro Vernet
Administrator
Wouter,

Wouter Zelle wrote
I get very weird behaviour with a very basic xforms:select, like this one:
Erik commited a change so the new value you select is always added at the end.

The bottom line is still that you can't count on the order of the items in your instance to match the order of the items in the itemset. It is a bit more complicated to have the item in the order in which they are in the itemset since multiple xforms:select with different (and possibly overlapping) itemset can change the content of a node. Erik added an RFE for this:

http://forge.ow2.org/tracker/index.php?func=detail&aid=314051&group_id=168&atid=350207

In the meantime, you'll need to write code to reorder the items or write code so the order wouldn't have any impact.

Alex