small medium large xlarge

Generic-user-small
17 Aug 2008, 19:22
Thanh Doan (2 posts)

I am working through example codes of the 2nd edition. It has been working like a charm as I work through Task A to D until iteration D2.

When click on ‘Add To Cart’ I saw firefox pop up error dialog box.

RJS error: TypeError: $(element) is null

When I click on OK button Firefox show next error dialog box with this.

Element.update(“cart”, “<div class="cart-title">Your Cart</div>\n<table>\n \n <tr id="current_item" >\n\n

6×</td>\n <td>Pragmatic Project Automation</td>\n <td class="item-price" >$179.70</td>\n</tr>\n <tr>\n \n

2×</td>\n <td>Pragmatic Unit Testing (C#)</td>\n <td class="item-price" >$55.50</td>\n</tr>\n \n <tr class="total-line">\n <td colspan="2">Total</td>\n <td class="total-cell">$235.20</td>\n </tr>\n</table>\n\n<form action="/store/empty_cart" method="post" onsubmit="new Ajax.Request(‘/store/empty_cart’, {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">\n <input name="commit" type="submit" value="Empty cart" />\n</form>\n\n”); $(“current_item”).visualEffect(“highlight”, {startcolor: “#88ff88”, endcolor: “#114411”});

Note that in my index.rhtml I have this

@ <% form_remote_tag :url => { :action => :add_to_cart, :id => product } do %> <%= submit_tag “Add to Cart” %> <% end %> @

And in my layout store.rhtml I have this.

@

<%= stylesheet_link_tag "depot", :media => "all" %> <%= javascript_include_tag :defaults %>

@

I am using Rails 1.2.4 on Ubuntu 7.10 and firefox 3. I run the mongrel server version 1.0.1-1 at port local host:3000

Thanks for your help!

Tom Doan

You must be logged in to comment