Hi I have created the application by following the railcast video http://railscasts.com/episodes/74-complex-forms-part-2 However I am getting this error when I click "add element" RJS error: TypeError: Element.insert is not a function and then Element.insert("docs", { bottom: "<div class=\"doc\">\n\n Doc: <input .....etc I have added the <%= javascript_include_tag :defaults %> in layout files also here is my rjs line <%= render :partial => ''task'', :collection => @project.tasks %> please help me in this regards. -- Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
MrBanabas-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2010-Jun-01 16:33 UTC
Re: Element.insert_html is not function
Hi, Please verify that all included javascript files get successfully loaded into your html page. -- Volker Santosh Dvn schrieb:> Hi > > I have created the application by following the railcast video > > http://railscasts.com/episodes/74-complex-forms-part-2 > > However I am getting this error when I click "add element" > > RJS error: > > TypeError: Element.insert is not a function > > and then > > Element.insert("docs", { bottom: "<div class=\"doc\">\n\n > Doc: <input .....etc > > I have added the <%= javascript_include_tag :defaults %> in layout > files also > > here is my rjs line > <%= render :partial => ''task'', :collection => @project.tasks %> > > please help me in this regards. > -- > Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, I inserted required java script files in my html page that is new.html.erb Plaese verify the file... #Projects/new.html.erb <% form_for :project, :url => projects_path do |f| %> <p> Name: <%= f.text_field :name %> </p> <div id="tasks"> <%= render :partial => ''task'', :collection => @project.tasks %> </div> <%= link_to_function "Add a Task" do |page| page.insert_html:bottom, :tasks, :partial => ''task'', :object => Task.new end %> <p><%= submit_tag "Create Project" %></p> <% end %> #My controller i.e projects class ProjectsController < ApplicationController def index @projects = Project.find(:all) end def new @project = Project.new @project.tasks.build end def create @project = Project.new(params[:project]) if @project.save flash[:notice] = "Successfully created project and tasks." redirect_to projects_path else render :action => ''new'' end end def edit @project = Project.find(params[:id]) end def update params[:project][:existing_task_attributes] ||= {} @project = Project.find(params[:id]) if @project.update_attributes(params[:project]) flash[:notice] = "Successfully updated project and tasks." redirect_to project_path(@project) else render :action => ''edit'' end end end -- Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.