Using a Button to render partial


#1

Is there a way to render a partial using a button? Basically in a
content div I want the user to launch a new sub content item in the same
div by clicking a button.

Any help appreciated.

Loving rails more and more everyday.


#2

Arch S. wrote:

Is there a way to render a partial using a button? Basically in a
content div I want the user to launch a new sub content item in the same
div by clicking a button.

Any help appreciated.

Loving rails more and more everyday.

link_to_remote(“my button”,:update =>‘mydiv’,:url =>{:action =>
:myaction})

You can stylish your link to look like a button.
You have to specify on myaction

def myaction
render(:layout => false)
end

Hope this helps.

P

http://wiki.onrails.com.ar


#3

Pedro V. wrote:

link_to_remote(“my button”,:update =>‘mydiv’,:url =>{:action =>
:myaction})

You can stylish your link to look like a button.
You have to specify on myaction

def myaction
render(:layout => false)
end

Hope this helps.

P

http://wiki.onrails.com.ar

Wow that is cool. I was looking for a hack to get AJAX style behavior
and Rails gives a method to do exactly that.

Apparently I need to just spend the time reading the api.

Thanks!