I''m trying to update a div after form submission, for some reason it is dying on this line: render :update do |page| page[:body].replace_html :url => body_report_show(:id => params[:report_id]) end I get an alert window that says RJS error: TypeError: html has no properties Help?? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Typically that means that there is not an element on the page with that id. Glen wrote:> I''m trying to update a div after form submission, for some reason it > is dying on this line: > > render :update do |page| > page[:body].replace_html :url => body_report_show(:id => > params[:report_id]) > end > > > I get an alert window that says > > RJS error: > > TypeError: html has no properties > > > Help?? > > > > >-- Sincerely, William Pratt http://www.billpratt.net billp-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
To clarify, look at you source html and make sure there is an element on the page that has ''body'' as it''s id. i.e.: <div id="body"></div> William Pratt wrote:> Typically that means that there is not an element on the page with that id. > > Glen wrote: > >> I''m trying to update a div after form submission, for some reason it >> is dying on this line: >> >> render :update do |page| >> page[:body].replace_html :url => body_report_show(:id => >> params[:report_id]) >> end >> >> >> I get an alert window that says >> >> RJS error: >> >> TypeError: html has no properties >> >> >> Help?? >> >> >> >> >> > >-- Sincerely, William Pratt http://www.billpratt.net billp-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It should still be there. At this point in the application that div has been updated at least twice but I don''t use replace anywhere. Is there a way to pass data forward so that I could test with rendering a partial? I would need to set the @report variable again somehow for the partial. On Aug 16, 10:35 am, William Pratt <bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org> wrote:> To clarify, look at you source html and make sure there is an element on > the page that has ''body'' as it''s id. i.e.: > <div id="body"></div> > > > > William Pratt wrote: > > Typically that means that there is not an element on the page with that id. > > > Glen wrote: > > >> I''m trying to update a div after form submission, for some reason it > >> is dying on this line: > > >> render :update do |page| > >> page[:body].replace_html :url => body_report_show(:id => > >> params[:report_id]) > >> end > > >> I get an alert window that says > > >> RJS error: > > >> TypeError: html has no properties > > >> Help?? > > -- > Sincerely, > > William Pratt > > http://www.billpratt.net > bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The only other thing that immediately comes to mind is to validate your html after the last successful update to make sure it didn''t break. Since JS depends on a "mostly" valid dom, that could be it. If you are using Firefox, the web developer tool bar has the ability to validate local html and also the ability to view the "generated source" which will show the source for the page after js has modified it. For rendering as a partial, you can either directly access @report in the partial, or decouple the partial by setting a local variable like this: render :update do |page| page[:body].replace_html :partial => ''a_partial'', :locals => {:report => @report} end This would set the local variable "report" in the partial to the value of @report. Hope this helps. Glen wrote:> It should still be there. At this point in the application that div > has been updated at least twice but I don''t use replace anywhere. > > Is there a way to pass data forward so that I could test with > rendering a partial? I would need to set the @report variable again > somehow for the partial. > > On Aug 16, 10:35 am, William Pratt <bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org> wrote: > >> To clarify, look at you source html and make sure there is an element on >> the page that has ''body'' as it''s id. i.e.: >> <div id="body"></div> >> >> >> >> William Pratt wrote: >> >>> Typically that means that there is not an element on the page with that id. >>> >>> Glen wrote: >>> >>>> I''m trying to update a div after form submission, for some reason it >>>> is dying on this line: >>>> >>>> render :update do |page| >>>> page[:body].replace_html :url => body_report_show(:id => >>>> params[:report_id]) >>>> end >>>> >>>> I get an alert window that says >>>> >>>> RJS error: >>>> >>>> TypeError: html has no properties >>>> >>>> Help?? >>>> >> -- >> Sincerely, >> >> William Pratt >> >> http://www.billpratt.net >> bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org >> > > > > >-- Sincerely, William Pratt http://www.billpratt.net billp-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, William. I actually just got done doing the latter and it is working now. The code is getting a bit sloppy, I really need to go through and clean it up. Thanks again for your help. On Aug 16, 10:56 am, William Pratt <bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org> wrote:> The only other thing that immediately comes to mind is to validate your > html after the last successful update to make sure it didn''t break. > Since JS depends on a "mostly" valid dom, that could be it. If you are > using Firefox, the web developer tool bar has the ability to validate > local html and also the ability to view the "generated source" which > will show the source for the page after js has modified it. > > For rendering as a partial, you can either directly access @report in > the partial, or decouple the partial by setting a local variable like this: > > render :update do |page| > page[:body].replace_html :partial => ''a_partial'', :locals => {:report => @report} > end > > This would set the local variable "report" in the partial to the value > of @report. > > Hope this helps. > > > > Glen wrote: > > It should still be there. At this point in the application that div > > has been updated at least twice but I don''t use replace anywhere. > > > Is there a way to pass data forward so that I could test with > > rendering a partial? I would need to set the @report variable again > > somehow for the partial. > > > On Aug 16, 10:35 am, William Pratt <bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org> wrote: > > >> To clarify, look at you source html and make sure there is an element on > >> the page that has ''body'' as it''s id. i.e.: > >> <div id="body"></div> > > >> William Pratt wrote: > > >>> Typically that means that there is not an element on the page with that id. > > >>> Glen wrote: > > >>>> I''m trying to update a div after form submission, for some reason it > >>>> is dying on this line: > > >>>> render :update do |page| > >>>> page[:body].replace_html :url => body_report_show(:id => > >>>> params[:report_id]) > >>>> end > > >>>> I get an alert window that says > > >>>> RJS error: > > >>>> TypeError: html has no properties > > >>>> Help?? > > >> -- > >> Sincerely, > > >> William Pratt > > >>http://www.billpratt.net > >> bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org > > -- > Sincerely, > > William Pratt > > http://www.billpratt.net > bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---