observe_field example of two related selects

I've done the 'Googling' for days now to find an example of using two dependent select statements on a form where the user selects the parent record value and the observe_field 'kicks in' to create another select that shows parent.children offerings. Is there anyone I can pay to provide me with the simplest example? If so, please contact me by email. Hopeful thanks, David

Hi David,

I've done the 'Googling' for days now to find an example of using two dependent select statements on a form where the user selects the parent record value and the observe_field 'kicks in' to create another select that shows parent.children offerings. Is there anyone I can pay to provide me with the simplest example? If so, please contact me by email.

The general model, having rendered the form, is to pass the selected parameter back to a controller which then a) uses that value to query the database for the values to use for the second select and then b) uses rjs to render a partial containing the second select, passing the collection obtained in a) in via a local or via an instance variable.

Which of these steps are you having trouble with? Post the (relevant snippets of) code you've got and we can help.

Best regards, Bill

InventoryTrackers wrote:

I've done the 'Googling' for days now to find an example of using two dependent select statements on a form where the user selects the parent record value and the observe_field 'kicks in' to create another select that shows parent.children offerings. Is there anyone I can pay to provide me with the simplest example? If so, please contact me by email.

Unfortunately, it's best not to use observe_field. Rails' JavaScript helpers mix JS into HTML, which is bad practice (Rails 3 will fix this). Just write the JavaScript yourself -- it's quite simple -- and put it in an external file.

Hopeful thanks, David

Best,