Forum: Ruby on Rails forcing onChange in a partial

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9f4a65c520a69cd357d830661e172272?d=identicon&s=25 JannaB (Guest)
on 2009-05-27 17:01
(Received via mailing list)
I have a partial view which incorporates on onChange option in a form.
It works great when I actually change the select box which it is an
option to. However, when the div which contains this partial first
shows, the onChange doesn;t fire. How can I force this to fire when it
is first shown? Thanks Janna B,

<%= f.label :country %><br />
  <%= f.country_select :country, Carmen.default_country, {},
    {
      :onChange => remote_function( :url => { :action =>
'_get_states' }, :update => "state", :with => "'country=' +value")
    } %>
This topic is locked and can not be replied to.