Dorian Mcfarland
2006-May-20 03:52 UTC
[Rails] RJS returned javascript written straight to page
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 -- -- I do things for love or money
Dorian Mcfarland
2006-May-20 04:30 UTC
[Rails] RJS returned javascript written straight to page
ignore this! I forgot to remove the :update from my link_to_remote sorry Dorian Mcfarland wrote:> 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 >-- -- I do things for love or money