The default action still fires though. I've tried the following as well:
1) preventDefault + stopPropagation with the result that the default action is not fired but Rails.fire does nothing but the event listener keeps getting executed in an endless loop.
2) return false with the result that the default action fires, which is weird since it is equivalent to above.
3) stopPropagation with the result that the default action fires, but submits a request to the server expecting HTML, not JS.
I have a form_for as follows:
<%= form_for @new_house.house, url: houses_path, remote: true, html: { id: 'subscribe-form' } do |f| %>
I have a class which adds a listener to the form when onSubmitForm is called:
The default action still fires though. I've tried the following as well: 1) preventDefault + stopPropagation with the result that the default action is not fired but Rails.fire does nothing but the event listener keeps getting executed in an endless loop. 2) return false with the result that the default action fires, which is weird since it is equivalent to above. 3) stopPropagation with the result that the default action fires, but submits a request to the server expecting HTML, not JS.