Jonathan wrote:
Does anyone know if it's possible to force a 'select' element (or
select1) to bind each selected value to a seperate element when
written to a file, instead of just putting all the values in one
space-seperated element?
For example if you had a select (radio) form control for film genres
and you selected 'Thriller' and 'Action'; when you write this to an
XML file I would like to get:
<genre>Thriller</genre><genre>Action</genre>
instead of <genre>Thriller Action</genre>
I think to achieve that you need an itemset as in the following example:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<title>a select element with an itemset</title>
<xf:model id="main">
<xf:instance>
<form-data xmlns="">
<gods />
</form-data>
</xf:instance>
<xf:submission method="POST"
action="http://sinex.hut.mediapoli.com:8080/xforms/request" />
</xf:model>
<xf:model id="gods">
<xf:instance>
<gods xmlns="">
<god>
<name>Kibo</name>
<description>He who greps</description>
</god>
<god>
<name>Xibo</name>
<description>He who xgreps</description>
</god>
<god>
<name>Lance</name>
<description>He who bikes</description>
</god>
</gods>
</xf:instance>
</xf:model>
</head>
<body>
<p>
<xf:select model="main" ref="gods">
<xf:label>Favorite gods</xf:label>
<xf:itemset model="gods" nodeset="god">
<xf:label ref="description" />
<xf:copy ref="name" />
</xf:itemset>
</xf:select>
<xf:submit>
<xf:label>submit data</xf:label>
</xf:submit>
</p>
</body>
</html>
When I submit that with XSmiles I get for instance the following data
submitted:
<form-data xmlns="" xmlns:xf="http://www.w3.org/2002/xforms">
<gods><name>Kibo</name><name>Xibo</name></gods>
</form-data>
--
Martin Honnen
http://JavaScript.FAQTs.com/