Hi I"m trying to run through the sample Depot app while I learn all the little pieces of Rails and I came upon an error I''m intrigued by. I am adding an Ajax hook into a page view and the content is rendered correctly (It''s the D2 - Ajax Based Cart section). The problem is, when I use the ''add to cart'' button it adds the element but the HTML sent back by the Ajax call isn''t treated by the stylesheets (although all the data is intact, it''s just in black text / normal size), if I refresh the whole page it''s rendered fine. I have basically ''diffed'' the section of the cart being rendered and there is not a single thing wrong, hence why I suspect it''s how Firefox handle CSS applications post page processing. Then again I see site using Ajax without this issue so I know it''s me and not Firefox. :) -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Jean Nibee
2007-Jun-27 04:04 UTC
Re: Agile web development with Rails - Issue with Depot app
OKay I"ll approach this from another angle. I click to update my cart, works fine but renders the cart with no formatting. If I refresh the whole page the formatting is fine. Now, if I click on the "add to cart" button AGAIN I get the following error: RJS Error: TypeError element has no properties I haven''t been able to find anything on the web that deals with this problem. (At nothing that has helped explain the issue and help me figure out the solution) Thanks in advance. -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Michael Latta
2007-Jun-27 04:17 UTC
Re: Agile web development with Rails - Issue with Depot app
You are in IE right? Try firefox. This sounds like an IE problem I ran into a while back. Failing that, use FireBug under firefox to verify the response to the AJAX call is what you think it is, and the CSS class or properties are being set. If you are relying on some javascript to post-process the HTML to add CSS tags (as DOJO does), then this may not be processing the updated HTML. Michael On Jun 26, 2007, at 9:04 PM, Jean Nibee wrote:> > OKay I"ll approach this from another angle. > > I click to update my cart, works fine but renders the cart with no > formatting. If I refresh the whole page the formatting is fine. > > Now, if I click on the "add to cart" button AGAIN I get the following > error: > > RJS Error: > TypeError element has no properties > > I haven''t been able to find anything on the web that deals with this > problem. (At nothing that has helped explain the issue and help me > figure out the solution) > > Thanks in advance. > > -- > 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-/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 > -~----------~----~----~----~------~----~------~--~--- >
Jean Nibee
2007-Jun-27 04:44 UTC
Re: Agile web development with Rails - Issue with Depot app
Michael Latta wrote:> You are in IE right? Try firefox. This sounds like an IE problem I > ran into a while back. Failing that, use FireBug under firefox to > verify the response to the AJAX call is what you think it is, and the > CSS class or properties are being set. If you are relying on some > javascript to post-process the HTML to add CSS tags (as DOJO does), > then this may not be processing the updated HTML. > > MichaelFirebug rocks thanks! Okay The problem was a Code 13 (13" from the Monitor). Basically what set me off the whole time is the fact that rendering on reload, and not when I hit the Ajax button, worked. This told me something was missing that tells the browser what style to apply. Digging into the code being displayed (with Firebug), I notice it''s all wrapped around a DIV Tag, but when I hit my submit button it''s not there anymore. The reason was this: I had: page.replace( "cart", :partial => "cart", :object => @cart ) I should have had: page.replace_html( "cart", :partial => "cart", :object => @cart ) The replace method was replacing the WHOLE div not just the ''inner html'' portion of it. Thus the first process was submitting properly (but not rendering because it had no class ID) and the second, and subsequent submits, were missing an ID so the Ajax couldn''t find it to ''refresh'' it''s state... I.E. The RJS template couldn''t find the "cart" element to update: Love this forum. Always points me in the right direction IF doesn''t answer the problem directly. :) Thanks Mike. (I hope you don''t mind being called Mike) -- 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-/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 -~----------~----~----~----~------~----~------~--~---