asking for help with select form helper and observe_field

I have a select form helper and an observe_field that's observing the select and calling an action when the select changes. However, I'm having trouble passing the right parameters from the select.

The select helper is inside of a form_for and looks like:, @books)

The observe_field looks like: observe_field :id, :url => { :action => 'index' }

When the post request occurs, I see that the right value parameter from the select is passed, but is of the form: value => nil, which I can't work with.

Can someone lend me a hand?

you’re observing the wrong field? You’re specifying :id in your observe_field (in the example you gave us)

The correct way to do that is:

observe_field(“object_name”, :url => { :action => ‘index’ })

How are you specifying the ID for the object? I’m guessing you didn’t specify just :id for it :slight_smile:

Try this:

observe_field 'books_name', :url => { :action => 'index' }

n.b., you'll have to look at the id in your HTML to make sure 'books_name' is right, but the documentation on observe_field is specific that the first argument is the DOM id of the field. If you are still getting nil values, try a second parameter to the hash:

  :with => "Form.Element.serialize('your_field_id')"

Had everything right. I just needed to add the :with option. Thanks!!