Bill Moseley wrote:
> I have a table that has city, state and postal code.  I want to
> auto-fill the city and state when a postal code is entered.
> 
> The city and postal code are simple text fields, but the state is a
> drop-down list with abbreviations as the value, and the full state
> name as the option text.
> 
> I assume with Ajax.Updater I could just return the HTML for both the
> city and state fields -- including the entire option list.

If you use Ajax.Updater, then the result would need to be in (X)HTML like you 
said.

> But, are there any tools available that will update the option list
> (change "selected") in place?  That is, have the ajax request only
> return the state and city code, and update selected item?

You could instead use Ajax.Request which would receive an XML doc which would
contain the values you need. Then you can do something like this:

  $('id_of_city_field').value = city;
  $('id_of_state_dropdown').value = state;

-- 
Michael Peters
Developer
Plus Three, LP

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to