04 Jul 2008, 19:42
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

07 Jul 2008, 23:19
Mike-120_pragsmall

Mike Clark (51 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

10 Jul 2008, 22:25
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

22 Apr 2010, 22:08
Generic-user-small

Anton Zolotov (1 post)

Is there a way to do this with radio buttons? I have one attribute status:string which can either be “agree”, “neutral”, or “disagree” and I would like to use radio buttons to edit that.

  You must be logged in to comment