Write a handler for the "change" event coming from the State combo box. In that handler, set the dataProvider of the City combo box.
- Gordon -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of sandip_patil01 Sent: Friday, September 16, 2005 1:40 AM To: [email protected] Subject: [flexcoders] Re: HOw combo box populated Can you Plz tell me or if possible send me the code how to get cities popualted in combo box when state is selected from another combo box. --- In [email protected], "bsd" <[EMAIL PROTECTED]> wrote: > I have built a custom City/State/Zip component to use throughout an > application and, hopefully, throughout multiple applications. > > > > It consists of three ComboBoxes; if the user selects the state, it populates > the city ComboBox with the cities for that state pulled from a database. > Once the user selects a city, the zip codes for that city are then populated > in the third ComboBox. It also works in reverse where the user can type in > the zip code in the editable ComboBox and the State and City ComboBoxes are > populated and selected with the appropriate data. > > > > > > Okay, all that's working. The application at hand is one where the user > creates an event and selects the hotel for that event. Right now I'm > dealing only with the hotel data. There is a panel to list all the hotels > in the database and a panel to edit that hotel's data (along with panels for > adding hotels, etc.). > > > > The application has a model to hold the data for the particular hotel being > dealt with ( > > <mx:Model id="HotelToEdit">{roHotels.getHotel.result._items[0]} </mx:Model>) > > > > > > I have the custom component dropped into my application on an edit form > with the id="editCityStateZip" and the data passed in so that is looks like: > > > > <CityStateZip id="editCityStateZip" state="{HotelToEdit.HotelState}" > city="{HotelToEdit.HotelCity}" zip="{HotelToEdit.HotelZip}" /> > > > > The user selects the hotel from the first panel, clicks a button that calls > the RemoteObject (roHotels) that is used to pull the hotel data from the > database and is directed to the Edit panel. > > > > Now, all of this is working so far. However, when the user goes back to the > main panel that lists all the hotels, selects a new hotel, clicks the button > and is sent back to the edit panel, all the data in that edit panel is > updated except for the that in the CityStateZip component. > > > > I've created a test function within the custom component to trace the data > values for the city, state and zip variables and the correct ones are there > in the component. It just seems that the function that picks the state in > the state ComboBox, fn_pickState(stateName), (as this is the one that drives > the others) gets fired before the data in model is changed or doesn't get > fired after the initialization of the ComboBox. I call this function using > the modelChanged event handler of the state ComboBox. I'm also calling it > using the resultHandler attribute of my RemoteObject. I've also tried > calling it with the function that loads the data for the edit panel and > using the valueCommitted method of the state ComboBox. None of these are > working. > > > > What am I missing here? How do I call my function after the data has been > returned from the database and loaded into my data model? I'm getting a > huge headache from banging my head against the wall for two days! > > > > Please help! > > > > Thanks in advance, > > Brad -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

