beginner question...really.

Hi,

I want to create a select form and based on what the user chooses on the select form, I want to connect to different tables and display the content.

I'm clueless on how to go about it. Any pointers would be appreciated.

The select helper is your friend

http://api.rubyonrails.com/classes/ActionView/Helpers/FormOptionsHelper.html#M000506

Thanks... i got the select option set up...but how would i get data from diffrerent tables depending on user's choice?

Hi there, I'm not sure if this is exactly what you want but it got me going down the right path a while ago:

This will walk you through getting specific data into the select form from a db table.

There's also a way to do this with AJAX auto_complete

http://slash7.com/articles/2005/8/13/ajaxariffic-autocomplete-with-scriptaculous

Hope this helps!

Tyler

Thanks...i dont think i was clear

im not looking to populate the select form from db table. im looking to get data off different db tables depending on the choice that the user makes from the select form.

You can get from different Table of you page form.

If you want create a User and in this page, you have a link to School.

You can made a select for all school that you have with

<%= select :school, school_id, School.find(:all).collect {|s| [ s.name, s.id ] } %>

After you have the school_id good for creation and when you made the creation, you have link to School.

Else, you can define the param as you want and use it like an other params.

Hi,

if I understand correctly -- the visitor's selection will be available for you in params hash in your controller. In the controller you can have some case...when logic, accessing different models = different DB tables. Is this what you are looking for?

Karel