Forum: Ruby on Rails RJS returned javascript written straight to page

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.
F719c6cb34bd5b691c12b373b7244b4d?d=identicon&s=25 Dorian Mcfarland (tachekent)
on 2006-05-20 05:53
(Received via mailing list)
hi there,
I have in my controller, the following to catch a link_to_remote:

  def form_part_add_personnel
    @credit_types = CreditType.find(:all)
    p = Credit.new()
    p.id = rand.to_s[2..-1]
    render :update do |page|
      page.insert_html  :bottom,
                        "script",
                        :partial => 'films/form/personnel',
                        :locals => {
                          :type => @params[:type].gsub(/_/, ""),
                          :available_types => @credit_types.select {
|ct| ct.personnel_type == @params[:type] },
                          :personnel => p
                        }
      page.visual_effect :highlight, @params[:type].gsub(/_/, ""),
    end
  end

whenever I use this, the generated javascript just gets pasted right in
like this. over the top of everything else in the div it's supopsed to
be inserting into:
new Insertion.Bottom("script", "  <div class=\"repeatGroup\"
id=\"script_701127528526052\">\n    <p class=\"removeControl\"> etc...

I'm running 1.1.2, I've updated my scripts, but I can't seem to get this
to work...

any ideas?

head banging

d
F719c6cb34bd5b691c12b373b7244b4d?d=identicon&s=25 Dorian Mcfarland (tachekent)
on 2006-05-20 06:32
(Received via mailing list)
ignore this!

I forgot to remove the :update from my link_to_remote

sorry
This topic is locked and can not be replied to.