@7stud,

the "onchange" behavior make a function call, that's right, and this
function (load_part_price_select() ) belongs to a js file, in this
case I did put it on the application.js file.

this is actually working for me.

@Filippos,

I haven't installed rails 3.1 yet, still on 3.0.9 for now, so I can't
tell you that, sorry.


On Aug 11, 1:25 am, Filippos <filippos...@gmail.com> wrote:
> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to