Forum: Ruby on Rails mimic the Confirmation javascript

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mongeta 9. (Guest)
on 2009-02-13 11:57

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:
  <input name="commit" onclick="return confirm('Confirm this form ?');"
type="submit" value="Recibir" />

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'} %>


This topic is locked and can not be replied to.