Observe_field default parameter

Hi fellow rubians :wink:

Im trying to populate one collection_select from another and I got it
pretty much down I think:

VIEW 1 (first combobox):
<%= collection_select( :doctype, :name, @doctypes, :id, :name, options =
{:prompt => “Select doctype”}) %>

<%= observe_field ‘doctype[name]’, :frequency => 2,
:update => ‘fieldtypes’,
:url => {:action => ‘doctype_changed’,
} %>

Second combobox is about the same. Controller method:

def doctype_changed
@doctype_pages, @doctypes = paginate :doctypes
@fieldtypes = @doctypes[???].fieldtypes
render :partial => “fieldtype”, :layout => false
end

Now this works fine if i give it a number in the ??? part and info
pops up in the second combobox just fine. Now obviously what I want to
is to pass the value of combobox 1 to this method, but I cant figure out
what this parameter is called.

In the errormessage it states I send the correct value, I just need to
know how to reference it in my doctype_changed-method:

Request
Parameters: {“1”=>""}

(etc.)

Thanks for any help :slight_smile:

<%= observe_field ‘doctype[name]’, :frequency => 2,
:update => ‘fieldtypes’,
:url => {:action => ‘doctype_changed’,
} %>

I got it to work by adding :id => :doctype now. But the id param in
always contains “0” (first choice in the dropdown). Any ideas why?

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