Hi,

Thank you for your reply.

Can I assume the method you stated is used when the values are inside 
the database? Or does it work the same if it is not?

Thanks, once again.

Charanya Nagarajan wrote:
> Deb Liew wrote:
>> Dear all,
>> 
>> I am pretty new to ruby on rails and I am supposed to create a form with
>> a few drop down options. The first drop down option will affect the
>> result in the data appearing in the drop down option for the second
>> field. E.g. If user select mobile phone as their device, the next drop
>> down will show the different OS of the phone such as Android, Symbian
>> etc.. and not OS of a computer.
>> 
>> Hope to receive replies/help on this.
>> 
>> Many Thanks in advance.
> 
> Hi,
> 
> You can use OnChange on the First select Box and call a remote function
> like
> <%= collection_select :device, :id, @devices, :id , :name, {}, 
> {:onchange =>  remote_function( :update => "operating_system", :url => { 
> :controller => "devices", :action => "get_os"}, :position => "replace", 
> :with => "'device_id='+this.value") } %>
> And have an element say div with id="operating_systems"
> 
> In devices controller,action get_os
> Find out @os (params[:device_id] will give you the device's id from 
> which i suppose you can get the list of OS for the device)
> 
> Have a partial called _get_os.html.erb which will have the select box 
> for the OS
> <%= collection_select :os, :id, @os, :id , :name %>
> 
> This is one of the many ways you can implement this functioanlity.Hope 
> You find this useful.

-- 
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