[Ruby on Rails] How to Display Confirmation Dialog After Pressing Form Submit Button

Tadashi Shigeoka ·  Sat, January 21, 2012

In Ruby on Rails 3.1, I’ll introduce how to display a confirmation dialog after pressing the submit button of a form.

You just need to pass the message to be displayed in the dialog to submit_tag with the :confirm parameter.

submit_tag "Save", :confirm => "Are you sure?"
# => 

With this, when you press the submit button, a dialog like the one below will be displayed.

That’s all.

Reference Information

That’s all from the Gemba.