Wednesday, August 10, 2011

[Rails] Re: How can I update a div value using Ajax but calling a function on the OnChange?

now with rails 3.1 doesn't all the java code go in a *.js.coffee file
inside the app/assets/javascripts/ ?
or do we write it on the corresponding view directly?

On Aug 10, 7:05 pm, 7stud -- <li...@ruby-forum.com> wrote:
> Kleber Shimabuku wrote in post #1015905:
>
>
>
> > and the form
>
> > <p class="fields">
> >   <%= f.collection_select(:part_id, @parts, :id, :title, { :prompt =>
> > true } , { :onchange => "load_part_price_select(this.id,
> > this.options[this.selectedIndex].value);"  } ) %>
> >   <%= f.label(:part_id, "Price: ") %>
> >   <span class="price"></span>
> >   <%= f.hidden_field :_destroy %>
> >   <%= link_to_remove_fields "remove", f %>
> > </p>
>
> js shouldn't be in your html, i.e. this:
>
> { :onchange => "load_part_price_select(this.id,
>
> > this.options[this.selectedIndex].value);"
>
> should be done up in the <head> section of your html.  In order to do
> that, you have to put your js inside a function that executes after the
> page has loaded.
>
> --
> Posted viahttp://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate