RJS error: TypeError: null value....
Bill Thayer
9 posts
|
...or TypeError: object has no properties for FireFox, and a [object Error} in IE when using “respond_to { |format| format.js }” Hello, So far great book but this error has stopped me and I cannot move forward (I tried). I have read all of the posts here, double checked my code, checked all of the troubleshooting tips on page 132, experimented a little and still cannot get a clue as to what’s wrong. Please help because I must get past this. Symptoms: try { I was able to get this try block above by clicking on the images. It returns a page and not a dialog box. If I comment out the “respond_to { |format| format.js }” line in the add_to_cart method (see store_controller.rb) then use “redirect_to_index” in it’s place, clicking the image returns to me expected functionality on the page with the following output added to the development.log file: Processing StoreController#add_to_cart (for 127.0.0.1 at 2008-06-24 14:50:13) [GET]
Session ID: 8cff562dcdfcd4fb9787f48188e1afb4
Parameters: {“action”=>”add_to_cart”, “id”=>”1”, “controller”=>”store”}
[4;36;1mProduct Columns (0.015000)[0m [0;1mSHOW FIELDS FROM `products`[0m
[4;35;1mProduct Load (0.000000)[0m [0mSELECT * FROM `products` WHERE (`products`.`id` = 1) [0m Processing StoreController#index (for 127.0.0.1 at 2008-06-24 14:50:14) [GET]
Session ID: 8cff562dcdfcd4fb9787f48188e1afb4
Parameters: {“action”=>”index”, “controller”=>”store”}
[4;36;1mProduct Load (0.000000)[0m [0;1mSELECT * FROM `products` ORDER BY title[0m Clicking on the “Add to Cart” button produces the same output in the log but the completion times vary. The cart does not update however until I hit F5. Note: The output from the log file reads: Processing StoreController#add_to_cart (for 127.0.0.1 at 2008-06-24 15:06:26) [POST]
Session ID: 8cff562dcdfcd4fb9787f48188e1afb4
Parameters: {“commit”=>”Add to Cart”, “authenticity_token”=>”c32e382c02901e70877453742461b3f550effce9”, “action”=>”add_to_cart”, “id”=>”3”, “controller”=>”store”}
[4;36;1mProduct Columns (0.000000)[0m [0;1mSHOW FIELDS FROM `products`[0m
[4;35;1mProduct Load (0.016000)[0m [0mSELECT * FROM `products` WHERE (`products`.`id` = 3) [0m Thank you in advance for helping me. Regards,
|
Ben Ward
1 post
|
Well, this is just a stab in the dark as I found your cry for help whilst I was trying to fathom out the same error message. I was getting the RJS alert popup telling me
but Firebug was showing me nothing was wrong with the content. I tried checking through the escaped characters and they all matched up. It turned out the RJS template was set to update a div in one of my views which had been labelled with a CLASS, rather than an ID.
I changed it to
and all was ajax-y heaven |
Bill Thayer
9 posts
|
Thank you Ben, I tried your solution by changing the class= to id= in _cart.html.erb. I really didn’t see any other file where it would makes sense to try it. The result is that the cart title was not bold. The product id does get passed to the add_to_cart function so otherwise the app is fine. It does update the cart correctly by adding the item but does not render without hitting an F5 (refresh). The “Empty Cart” button works as expected and does not throw the RJS error. Regards, |
3 posts, 2 voices
