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,

On Sat, 2010-02-06 at 11:29 -0800, 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.

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,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs