mois3x / sweet-alert-rails-confirm

A Rails confirm replacement with SweetAlert
MIT License
73 stars 50 forks source link

Submit button_tag with confirm not sent in form params #34

Open morismael opened 8 years ago

morismael commented 8 years ago

Hello,

In my app I use Fontawesome icons so my submit tags use button_tag helper in order to make the icons appear. I have the following issue:

This works :

<%= button_tag name: 'commit', class: "btn btn-secondary btn-sm", title: "Supprimer définitivement", value: 'Delete' do %> <%= icon('trash', '') %> <% end %> with the following logs:

Parameters: {"utf8"=>"✓", "authenticity_token"=>"wSx7XnfCN2jYUiyNDNsn3oQt2EXkpcx3pwg3Lue+wNMgVC0/VR67cRYq3TQZBKjKffYDqKSJkrHEHvogu7GuIg==", "commit"=>"Delete", "conversation_ids"=>["cd65e468-54c8-4256-85be-d2c928f932c7"]}

But when I want to confirm with the user like this:

<%= button_tag name: 'commit', class: "btn btn-secondary btn-sm", title: "Supprimer", value: 'Delete', data: {:confirm => 'Êtes vous sûr?', :'confirm-button-text' => 'Ohh oui', :'cancel-button-text' => 'Ooops!', :'confirm-button-color' => '#1ab394', :'sweet-alert-type' => 'info', text: 'Cette action est irréversible'} do %> <%= icon('trash', '') %> <% end %>

the form is submitted without the commit param:

Parameters: {"utf8"=>"✓", "authenticity_token"=>"k2UqZPiA88FGKxd3T8RQjy1yhqdFILuHlvNwX86s5rhyHXwF2lx/2IhT5s5aG9+b1KldSgUM5UH15b1RkqOISQ==", "conversation_ids"=>["cd65e468-54c8-4256-85be-d2c928f932c7", "5a8f5971-ed74-4fe1-9011-1d7cf70b55d1"]}

Thanks for your help.

trooster commented 7 years ago

@morismael : Did you find a solution or workaround for this?