Hi, I have a submit_tag in test.rhtml ... <% submit_tag ("Save") %> I want to add the following popup box onclick: "Are you sure?" Yes No where "Yes" & "No" are buttons. If "Yes" is pressed, I go to another controller with parameters else I stay with test.rhtml. How do I do it? Thx, Ram.
the easy way is probably to have something like
<%= submit_tag “Save”, :onclick => “return confirm(‘Are you sure?’)”
assuming your form action already points to the place you want to go to
I have a submit_tag in test.rhtml I want to add the following popup box onclick: "Are you sure?"
you can just use the :confirm param at the form_tag. You only have to
provide the string for the confirm box and that’s it (i.e.
:confirm=>‘Are you sure?’)
nicer popup then you should implement yours by using a javscript
function returning true/false and to call it you can just pass the
:onsubmit param to the form.