Generic-user-small Sander Heilbron 2 posts

Hi,

I used this recipe in one of my rails apps, but it looks like there is something wrong inside the prototype.js file when the checkbox is clicked.

The error console in Safari shows the following error:

Undefined value
http://testapp.local/javascripts/prototype.js?1209641526 (line 941)

line 941 is the following line (show function):
element.style.display = '';

I tried several versions of the prototype.js file all resulting in the same error.

Who of you did have success using this recipe?

Thnx,
Sander

 
Mike-120_small Mike Clark Administrator 35 posts

Hi Sander,

Have you tried the example application in the source code bundle that’s available from the book’s title page? I know that one worked when the book was published. You might want to see how your application differs from the example.

Mike

 
Generic-user-small Sander Heilbron 2 posts

Hi Mike,

I have tried the example application and it works without any problems. In my own application it was not working because of the ‘admin’ namespace which is used. I thought modifying :onclick => toggle_value(item) into :onclick => toggle_value([:admin, item]) would be ok, unfortunately not. This is not necessary.

To get it working when you make use of a namespace you have to modify the url_for method in the application_helper file. In case of namespace ‘admin’ this has to be url_for([:admin, object]). That’s all!

Sander

3 posts, 2 voices