On 15-03-2009 at 04:36, AK wrote:
> I'm trying to build a set of dependent drop-down menus, State and City.  When 
> one of the 50 states is selected from the 1st drop-down, the City menu is 
> populated with all the cities in that state.
> 
> What's the best way to do something like this (w/ Stripes)?  Also, anyone 
> know 
> where I can get this data?!

Because the dependent dropdown needs to change when the selection in the
other one changes, you'll need to implement an onChange handler. You have
several options for this, one without AJAX. In any event, browsers will need
to have Javascript enabled due to the onCHange handler.

The simplest option is to submit the form and redisplay it. You'll need to
put the dropdowns outside of any overwritten values (domain objects come to
mind) to ensure that th form input it redisplayed. The dependent dropdown
will then be filled with the correct values.

The other option is to use AJAX. When the State dropdown changes, you'll fire
a special event. You can choose here if you want to have the ActionBean
return a list of values (with which you replace the current options), or a
JSP fragment with the new control. I'd choose the latter, because you can
most easily have different labels & values, and because you can group and/or
disable items.


Oscar

-- 
   ,-_  Oscar Westra van holthe - Kind      http://www.xs4all.nl/~kindop/
  /() )
 (__ (  Inequality is the inevitable consequence of liberty.
=/  ()  -- Salvador De Madariaga - "Anarchy or Hierarchy" (1937)

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to