RJS: how to find which button was clicked

On a normal form one could use this logic to get which submit button was clicked.

if params[:commit].include? "Preview"
   # do something
elsif params[:commit].include? "Post"

 # do something
else
  # do something

end

But if I use RJS and form_remote_tag then the above logic will not work.

I was wondering if anyone has any solution on how to find which button was clicked when form_remote_tag is being used.

Thanks.

  • Raj

Thanks Curtis. Thanks for posting the code and mentioning that it was prototype issue. I thought I was missing something here.

-=- Raj