Raja Venkataraman wrote:
> Jay Pangmi wrote:
>> Hi, I have two combo boxes. One combo box has the name of countries
>> stored in the database. So, when a country is selected from this combo
>> box I want other combo box to list all the cities stored in the database
>> related to that selected country without clicking any button. Any help
>> would be great.. thanks
> 
> There are 2 ways to do it.
> a) Have a onChange listener on your country Select control which submits 
> back to your action_controller and repopulate the form,
> 
> b) Make an AJAX call using remote_function method. Take a look at 
> http://www.railsbrain.com/api/rails-2.1.0/doc/index.html?a=M001957&name=remote_function
>  
> for an example.

Thank for the reply but me being new and bit dumb couldn't make use of 
it. I searched for the onChange listener in Rails but couldn't find. 
Also I couldn't figure out how I can use the remote_function that you 
suggested. I have made my one combo box as:
<form>
  <%=select("selected","location",GreatWalk.getAvailableLocations)%)
</form>

In the controller:
def self.getAvailableLocations
 @locations=GreatWalk.find(:all)
 @locationhoder=[]
 for locs in @locations
  @locationholder<<[locs.location,locs.location]
 end
 @locationholder
end

So, plz guide me thru... thnx.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to