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

RE: Reducing list

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Fri, 10 Feb 2006 16:47:47 -0000
To: <www-forms@w3.org>
Message-ID: <005c01c62e61$b90ead10$7e01a8c0@Jan>

Hi Adam,

The pieces of the jigsaw you need, are:

First, make a simulated combo-box by:

1. Using a repeat to hold the list.
2. Using an input to capture the user's data.
3. Use switch/case to show and hide the list when the input gets focus.


4. Use an XPath filter to filter the list, based on the data in input.
5. Use @incremental on the input control so that the list changes as you
type (otherwise you'll have to wait until the user navigates out of the
6. Use a trigger on each item in the list to select it.

Once you have this, you can duplicate it for the second 'drop-box', except
this time the filter on the second list should include the value of the
filter on the first list.

7. Write it all up and send it to the list!

The only other thing to mention is that there is currently no way to sort in
XForms, other than by writing your own extension function, or by getting the
server to do the sorting and filtering on the instance data. This latter
approach is pretty easy to do, and will still give reasonable performance.

If you want some ideas on how the code should look, our Timelog application
does exactly as I've described here, except that the data is obtained from
our server, and so we don't need the XPath filter bit. (There's also an
entry on my blog that shows how to build the list from Google Suggest.)



Mark Birbeck
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
b: http://internet-apps.blogspot.com/
w: http://www.formsPlayer.com/

Download our XForms processor from

> -----Original Message-----
> From: www-forms-request@w3.org 
> [mailto:www-forms-request@w3.org] On Behalf Of Flinton Adam
> Sent: 10 February 2006 16:13
> To: www-forms@w3.org
> Subject: Reducing list
> Dear All,
> Imagine I have an structure like this
> Element X Which has 0...n children Elements Y each of which 
> in turn has 0...n children Elements Z each of which has 
> content I am after.
> What I need in a form is:
> 1) To have a drop down list box showing all Y elements sorted 
> alphabetically. 
> 2) Typing into this drop down list box should give a reducing 
> list i.e.
> typing the letter r would give me all the Y elements starting 
> with the letter r, then typing a would give me the all Y 
> elements starting with the letter ra etc.
> 3) Finally selecting the Y element name I want should then 
> populate the second dropdown with the Z elements which are 
> children of that Y element.
> 4) Same as 2 but for the Z elements.
> 5) Selecting the right Z element should then give me the 
> content of that Z element.
> Any ideas?
> Adam
> This e-mail is confidential and privileged. If you are not 
> the intended recipient please accept our apologies; please do 
> not disclose, copy or distribute information in this e-mail 
> or take any action in reliance on its contents: to do so is 
> strictly prohibited and may be unlawful. Please inform us 
> that this message has gone astray before deleting it. Thank 
> you for your co-operation.
Received on Friday, 10 February 2006 16:49:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:16 UTC