Hey, I''m looking for a way to get the content of my div in my Rails view. I would like the literal HTML content, so only HTML and no Rails I thought inner_html would work, but I get a RJS exception (TypeError: $("content").innerHtml is not a function) Does anyone know how I can get the content? Thanks! In my controller I use this code: [code] def save_test render :update do |page| page[''content''].innerHTML end end [/code] Some more context maybe? I get a HTML form (without the form tags themselves) and put it into a rails form. What I want is that the user changes checkboxes, radiobuttons, fills out input fields etc and when the user saves, I want the literal changed content of the form as a string to save it to my database. The reason for this is that the several provided forms differ a lot and it''s only used as information, no calculations etc need to be done on it. So my view looks like this: [code] form_remote_tag :url=>{:action => ''save_trainee_evaluation'' do %> <div id="content"> <%= contract_trainer_trainee.evaluation_template %> </div> <%= submit_tag ''Opslaan'' %> <% end %> [/code] -- 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.
Anybody? If more info is needed, do ask! Thanks -- 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.
On 16 Mar 2010, at 16:44, Ignace S. wrote:> Anybody? > If more info is needed, do ask! > ThanksMore info is needed Best regards Peter De Berdt -- 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.
innerHtml is not a function. innerHTML is. Larry On Tue, Mar 16, 2010 at 6:25 AM, Ignace S. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hey, > I''m looking for a way to get the content of my div in my Rails view. I > would like the literal HTML content, so only HTML and no Rails > I thought inner_html would work, but I get a RJS exception (TypeError: > $("content").innerHtml is not a function) > > Does anyone know how I can get the content? Thanks! > > In my controller I use this code: > [code] > def save_test > render :update do |page| > page[''content''].innerHTML > end > end > [/code] > > Some more context maybe? I get a HTML form (without the form tags > themselves) and put it into a rails form. What I want is that the user > changes checkboxes, radiobuttons, fills out input fields etc and when > the user saves, I want the literal changed content of the form as a > string to save it to my database. > The reason for this is that the several provided forms differ a lot and > it''s only used as information, no calculations etc need to be done on > it. > So my view looks like this: > > [code] > form_remote_tag :url=>{:action => ''save_trainee_evaluation'' do %> > <div id="content"> > <%= contract_trainer_trainee.evaluation_template %> > </div> > <%= submit_tag ''Opslaan'' %> > > <% end %> > [/code] > -- > 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@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
Peter De Berdt wrote:> On 16 Mar 2010, at 16:44, Ignace S. wrote: > >> Anybody? >> If more info is needed, do ask! >> Thanks > > More info is needed > > > Best regards > > Peter De BerdtLittle more specific? What exactly do you want to know? Larry Meadors wrote:> innerHtml is not a function. > > innerHTML is. > > LarryYes, you''re right there, but as you can see, I use innerHTML in my controller. And the same error message (but then with ''innerHTML'') is triggered. -- 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.