Forum: Ruby on Rails mimic the Confirmation javascript

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D48be99143e13e40d1c44a4da63a53f4?d=identicon&s=25 Mongeta 99 (raimon)
on 2009-02-13 10:57
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:
  <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'} %>


thanks!

r.
This topic is locked and can not be replied to.