I followed this railscast to add "complex" functionality to a form. I added the ability to click a link to add an element to an object form and a link to remove it. 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 -- 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.
try to add <%= javascript_include_tag :defaults %> in your layout file On Mar 30, 12:31 am, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I followed this railscast to add "complex" functionality to a form. I > added the ability to click a link to add an element to an object form > and a link to remove it. > > 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-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thanks for the suggestion. It''s already in the layout file, any other ideas? On Mar 30, 10:39 am, Raven chen <enn.ra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> try to add <%= javascript_include_tag :defaults %> in your layout > file > > On Mar 30, 12:31 am, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I followed this railscast to add "complex" functionality to a form. I > > added the ability to click a link to add an element to an object form > > and a link to remove it. > > >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-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks for the answer, I included <%= javascript_include_tag :defaults %> and it worked! On Mar 30, 1:39 pm, Raven chen <enn.ra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> try to add <%= javascript_include_tag :defaults %> in your layout > file > > On Mar 30, 12:31 am, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I followed this railscast to add "complex" functionality to a form. I > > added the ability to click a link to add an element to an object form > > and a link to remove it. > > >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-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I recently overhauled pages for speed improvements including creating cached pages for my styles and javascript files and ended up with the same error. I performed diffs on my /public directories and found that my true.js file had concatenated file that was contained in another cached file. In other words, I had the same .js file being called twice. When I removed the duplicate, my error disappeared and my form worked properly. Good luck! -- 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.
I bumped into another problem made apparent using the horrible IE 7 browser. A javascript error showing there (but not in Firefox) led me to a code error in an outside vendor widget. Removing the code also stopped a seemingly unrelated error. You might consider removing all your .js files except the one that seems to throw the error. Adding your .js files one at a time might lead you to the problem file. -- 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.