Delimited List XBL Input Field

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

Delimited List XBL Input Field

gino-m
Attached I am sharing a custom XBL component I've created for entry of multiple values in a single input field.  The component behaves like an xforms:input, but its value is treated as a list of delimited values (comma, space, or other).  The values gets split/tokenized into separate elements in the model, populated based on the specified template.

Example:
        <xf:model id="model">
            <xf:instance id="instance" xmlns="">
            	<values/>
            </xf:instance>
            <xf:instance id="template" xmlns="">
            	<root>
            		<value ref=""/>
            	</root>
            </xf:instance>
        </xf:model>
...
    	<of:delimited-input  base="value" nodeset="value/@ref" template="instance('template')/value" 
    		delimiter="','"  normalize-space="true()" incremental="true" xxforms:size="55"/>

Entering the value "1,2,3,4,5", for example, will result in the following instance:
<values>
	<value ref="1"/>
	<value ref="2"/>
	<value ref="3"/>
	<value ref="4"/>
	<value ref="5"/>
</values>

We could have used an XML list type (e.g. @refs="1 2 3 4 5") for the same purpose, but there were a few limitations: XML lists are a) space-delimited only b) devoid of structure (would need to change the schema to add sub-elements) and c) are not yet supported (?) natively by XPath 2.0 (i.e. requires tokenize() to process individual items).  This component tries to give the best of both worlds; we can access values using a standard XPath like @ref, but the UI may be compressed to one input field, or broken up into separated ones once/if the need arises.  

Hope this helps,
Gino

Note: dropped into WEB-INF/resources/apps/xforms-sandbox/ and access http://localhost:8080/orbeon/xforms-sandbox/sample/delimited-input-test or equivalent to test:
delimited-input.xbl
delimited-input-test.xhtml
Gino Miceli
Forest Information Systems Specialist
Food and Agriculture Organization of the United Nations
FAO-Finland Cooperation Programme
Sustainable Forest Management in a Changing Climate
Forest Management Division, Rm. D-406
Viale delle Terme di Caracalla, s.n.c.
00153 Rome, Italy
http://www.fao.org/forestry
Reply | Threaded
Open this post in threaded view
|

Re: Delimited List XBL Input Field

gino-m
P.S. If anyone has an idea of how to associate the validation state of the nodes in the original model to the component, please share!
Gino Miceli
Forest Information Systems Specialist
Food and Agriculture Organization of the United Nations
FAO-Finland Cooperation Programme
Sustainable Forest Management in a Changing Climate
Forest Management Division, Rm. D-406
Viale delle Terme di Caracalla, s.n.c.
00153 Rome, Italy
http://www.fao.org/forestry
Reply | Threaded
Open this post in threaded view
|

Re: Re: Delimited List XBL Input Field

Alessandro  Vernet
Administrator
Gino,

Thank you for sharing this!

Alex

On Mon, May 10, 2010 at 6:46 AM, gino-m <[hidden email]> wrote:

>
> P.S. If anyone has an idea of how to associate the validation state of the
> nodes in the original model to the component, please share!
>
> -----
>
> Gino Miceli
> Forestry Information Systems Specialist
>
> Food and Agriculture Organization of the United Nations
> FAO-Finland Cooperation Programme
> Sustainable Forest Management in a Changing Climate
> Forest Management Division, Rm. D-406
> Forestry Department
> Viale delle Terme di Caracalla, s.n.c.
> 00153 Rome, Italy
> Tel: +39 06 570.56765
> Fax: +39 06 570.55137
> Website: http://www.fao.org/forestry
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Delimited-List-XBL-Input-Field-tp2165415p2165420.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet