Forum: Ruby on Rails Countries -> Cities Select box

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Vivek K. (Guest)
on 2006-01-06 11:31
(Received via mailing list)
I am trying to play with  a Countries -> Cities dynamically updating
box.that is if  someone selects a country then all the cities of that
country must be listed.Does anyone know of any data source for this?
I searched for it but couldnt find any good usable source.
Better still is there a module which I can mixin for this?
Chris H. (Guest)
on 2006-01-06 15:41
(Received via mailing list)
you can do it the Ajax way...
Alan F. (Guest)
on 2006-01-06 16:05
Chris H. wrote:
> you can do it the Ajax way...

The article uses Ajax to replace the entire SELECT element, since the
author found it impossible to replace the innerHTML.  I wonder if it
might be possible to use RJS[1] for something like this, and have the
ajax return javascript to repopulate the SELECT ?

Vivek K. (Guest)
on 2006-01-08 05:20
(Received via mailing list)
Well Actually I got that part working. and Yes I had to replace the
innerHTML including the select tag but then that was ok because other
than a
few countries for which I had an option of showing cities,I just wanted
show a blank text box. My only problem now is to figure out if there is
anyway to do the ascyn ajax update only if the value is one of the
i want to show a select option for. Because this results in unnecssary
to the server.
I guess I have to modify the generated javascript.
This topic is locked and can not be replied to.