[html-formfu] dynamically filter a Select list

Byron Young Byron.Young at riverbed.com
Mon Sep 14 17:43:01 GMT 2009


Ascii King wrote on 2009-09-14:
> I want to dynamically filter the amount of data returned when populating
> a Select field.  The select field I am using has too much data and
> causes the form to load very slowly.  I have several of these select
> boxes, that pull down different data. I need to be able to filter what
> data gets into the boxes based on choices the user makes.
> 
> For example: The user wants to select a doctor from the drop-down list.
> The user knows they want a doctor who'se name starts with 'L', but the
> drop-down box contains every doctor. I would rather the user just get a
> select box that conatins doctors that start with 'L'.
> 
> How can I cut down on the amount of data that is passed to the form on
> load? The only solution I have thought of so far is to give the user a
> text box to enter in the initial of the doctor they want. I assume they
> would have to get this text box before they got to the actual form.
> 
> Is there a bettr way?
> 

I don't think there is a built-in way to do this in HTML::FF (please correct me if I'm wrong!), but for things like this I just use FormFu to render the empty input fields in the form, and then I add some javascript to the page to asynchronously load the Select list data as the user types into the filter text box (or conversely you can have all the data loaded with FormFu and just filter it as the user types into the filter field).  FormFu still handles the rendering, validation, etc, but my javascript handles the list contents and filtering.

HTH,
Byron



More information about the HTML-FormFu mailing list