I have a form that takes some input and sends a POST request back to a Spring Boot instance, which triggers a file download through content disposition header.
The browser handles the download perfectly but it does not navigate away from the page, which is the normal behavior.
Now, the inputs contain sensitive information that must not remain in the form.
I can only intercept the form's onsubmit function but I can not use ajax to make the requests because the server returns multiple pages depending the state of the data (i.e bad input, wrong information, etc)
Clearing the fields before submission erases the form and all data gets lost.
Is there a way to clear the fields before or after the form has been submitted?