I was told about an issue today with the image_submit_tag not supporting the :confirm method on the element:
<%= image_submit_tag('buttons/submit.gif', { :confirm => 'Are you sure?' }) %>
so I thought I’d share a quick fix which would be the actual javascript returned by the function:
<%= image_submit_tag('buttons/submit.gif', { :onclick => 'return
confirm(\'Are you sure?\');' }) %>
Hope this can save some people time…
Thanks for the suggestion above.
But, in the confirmation dialog, it displays the url, like “The page at http://fhnd5.joyent.com:3000 says ‘Are you sure'” – I dont want this url displayed as the heading. How do I avoid that?
Thanks
Ashok
Hi Ashok,
By the sounds of it, you’re using Firefox, which automatically displays the url of the site in any alert/confirm javascript box. I guess it’s for security, so you can tell the message box is coming from the site you think it is… I’m not sure if there any way to get around that, short of writing your own alert/confirm system…
Sorry!