Remote_function problem

Hi there,

I have the following code in my view:

<%= check_box_tag ‘checkopen’, 1, params[:checkopen] == ‘1’,
:onclick => remote_function( :url => {:action => ‘index’) %>Open Now

But for some reason whenever the box is checked it calls the create
action instead of the index action. Any ideas what’s going on?

Thanks,
steve

On 8 Apr 2008, at 19:37, Steve G. wrote:

action instead of the index action. Any ideas what’s going on?

Does the html/javascript generated look ok ?

Fred

You can try passing the get method for the remote call.

<%= check_box_tag ‘checkopen’, 1, params[:checkopen] == ‘1’,
:onclick => remote_function( :url => {:action => ‘index’}, :method =>
‘get’) %>Open Now

I am not sure which method should be used. Try with get and post.

And it will be better if u specify the controller name also in the url.

It’s (probably) because he’s using restful routes.

Julian

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #3 out NOW!
http://sensei.zenunit.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs