I have a problem with a form inside a modal.
Here is my form
<%= form_tag({controller: "controller", action: "action"}, id: "form_id", remote: true) do %>
<button class="btn btn-default btn-xs btn-filter" id="id_button">
<%= number_field_tag "id", nil, placeholder: "0", class: "input_class" %>
<%= submit_tag("ok", id: "submit_add", class: "btn btn-success") %>
<% end %>
The submit tag works well, but jquery-ujs adds this event:
function(event) {
var button = $(this);
if (!rails.allowAction(button)) return rails.stopEverything(event);
// register the pressed submit button
var name = button.attr('name'),
data = name ? {
name: name,
value: button.val()
} : null;
button.closest('form').data('ujs:submit-button', data);
}
on the button identified by #id_button
, which causes that button to also submit the form, but I don't want that.
I found nothing about this problem.