Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails - How to put a confirmation popup on a f.submit?

I want to have a confirmation popup on a <% f.submit %> call on a new object form. Is there a way to do this without javascript?

like image 528
Joe Essey Avatar asked Apr 02 '13 18:04

Joe Essey


1 Answers

You want <%= f.submit :confirm => 'Your confirm message' %>. Just FYI, this is just the short hand for the javascript call.

Edit: As stated in other answers, the new way to have a popup confirm is:

<%= f.submit 'Save', data: { confirm: 'Your confirm message' } %> 
like image 161
spullen Avatar answered Sep 17 '22 14:09

spullen