Trying to make a custom :confirm message for a rails form that returns data from the submitted form–not just a static string.
<% form_for @foo do |f| -%>
<% f.text_field :number_of_bars -%>
<% f.submit :confirm => Are you really sure you want to use ##number_of_bars## bars? -%>
The idea is if the user puts in the number 3 in the number of bars text field the confirm message would show up like this: “Are you really sure you want to use 3 bars?”
Any ideas how to do this?
Try this:
Replace the
number_of_bars_idwith the id of your field.If you google a bit you will find a way for this to work with
:confirm.