Sweet-alert-rails-confirm with rails submit button

1.7k views Asked by At

I just installed sweet-alert-rails-confirm on my rails application, and it worked fine when using the data-confirm attribute with link_to, but when I added the data-confirm attribute to a form submit button it still shows the old javascript confirm prompt, like the following:

<%= f.submit "#{@projeto.new_record? ? 'Cadastrar' : 'Atualizar'} #{f.object.e_proposta? ? 'proposta' : 'projeto' }", data: { confirm: 'Tem certeza?' }   if current_user.administrador_do_perfil?(perfil)%>
1

There are 1 answers

2
aspencer8111 On

Just a guess, as I've never used that gem before, but instead of the f.submit, try adding simple button element with the data-confirm element.