You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have form that contains a text input and a file input. The file input makes a HTMX request 'onchange' for some pre submission processing and the form itself makes a HTMX request on submission.
The issue is that, when a request is made with the file input (to '/media_name/') , both the text and file data is shown in the Form data (in the network panel), but when a request is made with the form itself (to "/view_messages/9/User"), it only shows the text data.
Here is the payload when a HTMX request is made by file input
Here is the payload when a HTMX request is made by the form
The text was updated successfully, but these errors were encountered:
The mistake was from my end, I had an 'afterswap' event listener on the file input that sets the value of the file input to an empty string. That means the input file's value will always be empty before the main form submission because the file input's HTMX request is always called first before the form's HTMX request.
I have form that contains a text input and a file input. The file input makes a HTMX request 'onchange' for some pre submission processing and the form itself makes a HTMX request on submission.
Note that both the file input and form tags send requests on their default triggers 'onchange' and 'onsubmit' respectively.
Also note that I have prevented default on form submission using Javascript (prevent submission from refreshing the page).
The issue is that, when a request is made with the file input (to '/media_name/') , both the text and file data is shown in the Form data (in the network panel), but when a request is made with the form itself (to "/view_messages/9/User"), it only shows the text data.
Here is the payload when a HTMX request is made by file input
Here is the payload when a HTMX request is made by the form
The text was updated successfully, but these errors were encountered: