# Mimic the Confirmation javascript

**URL:** <https://www.ruby-forum.com/t/mimic-the-confirmation-javascript/160241>\
**Category:** Rails\
**Created:** [February 13, 2009, 10:57am UTC](https://www.ruby-forum.com/t/mimic-the-confirmation-javascript/160241 "2009-02-13T10:57:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![raimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@raimon](https://www.ruby-forum.com/u/raimon)\
**Post date:** [February 13, 2009, 10:57am UTC](https://www.ruby-forum.com/t/mimic-the-confirmation-javascript/160241/1 "2009-02-13T10:57:47Z")

</div>

Hello,

I’m using some Redbox modal windows in one application.

Som of them are specific and work well, but now I want to implement a  
general confirmation winodow, to mimic the javascript confirm function.

It started as an easy approach and now it’s horribly coded and very  
difficult to mantain, as I’m passing .action, :method, and some  
:parameters, and the general confirmation window sends those actions,  
parameters, etc. etc.

But, what I would prefer, a simpler approach, I simply ipen the modal  
window and if the user press OK, call the appropiate method/action, no  
matter if I’m inside a form tag, a simple link, etc. etc.

Any ideas ?

simple javascript:

this is what I’m calling now, passing some parameters, action, …

\<%= link\_to\_remote\_redbox button\_tag(‘Confirmar EnvÃ­o’), :url =\>  
{:controller =\> ‘expedients’, :action =\> ‘confirm’,:id =\> expedient,  
:type =\> ‘exp’, :action\_method =\> ‘send\_exp\_to\_us’, :message\_title =\>  
“Confirmar envÃ­o”, :message\_info =\>‘Aceptar para enviar los expedientes  
al centro de gestiÃ³n’} %\>

thanks!

r.
