Select helper

I have this form which is a lot of edit_in_place fields so it really
insn’t a form since there is no submit button. In this “form” is a link
for a country and when you click that a drop down appears in it’s place
and a country can be choosen, when that country is chossen the drop
downs turns back into a link with the newly choosen country as the text.
I had this working before by using options_from_collection_for_select
and adding an onchange and setting it equal to a remote_function call.
That worked. But now I would like for a particular country to be choosen
by default but with the same functionality. So I changed my code and
used a select helper:

<% func = remote_function( :update => ‘w_country’, :url => { :action =>
‘set_w_country’, :id => @user.id}, :with => “‘select=’ +
escape(value)” ) -%>

<%= select( “user”, “w_country”, Countrycode.find( :all, :order =>
‘country’ ).collect { |a| [a.country, a.id]},
:selected => Countrycode.find_by_country(‘USA’).id, :onchange =>
func ) %>

Now it selects the correct default country but my remote_function never
gets called or executed. I think what is happening is that I don’t have
the helper set up correctly - more specifically the :onchange. Does
anyone know how to add the onchange part to the select helper and to
have a certain entry set as the default? Thanks for any and all help,

-S

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