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
  # do something


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.


  • Raj

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

-=- Raj