Currently, I am working on a project that involves a form submission setup where a POST request is made to download a file.
Here is how the process is structured:
app ->
.setHandler 'eventForForm'
controller.submitForm()
controller ->
formView = new FormView
collection = collectionToUse
header ->
event: 'click': 'buttonClick'
buttonClick ->
triggerCallback to app for submit form
headerDom
<div><a href="#">Button to Submit</a></div>
new FormView
init ->
submitForm()
submitForm ->
$form = $('<form></form>')
#code that adds it to the page with required data and css
$form.submit()
$form.remove() #remove from dom
Everything seems to be functioning correctly. Events are triggered, correct data is sent, the form gets submitted, and the file download is initiated.
However, after the .submit() event, instead of performing a full page refresh, all populated data on the page disappears (the page goes blank). It doesn't navigate away from the page or perform a proper page refresh to repopulate the missing data in the views.
I am uncertain about what might be causing this issue, as the view and event handler setup appears to be correct.
Marionette.js version: 1.8.0, jQuery version: 1.8.3