-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read multi-part form data (fields and uploads) after submit #76
Comments
Hydro used to have it but I removed it to keep consistency with Bind lifecycle, which means that I wanted users to be able to control updating of the fields when it happens. If we wanted to support sending the fields on submit it would have to be an additional flag on hydro-on attribute, like: <form hydro-on:submit="(() => Model.Save())" hydro-attach-form /> But then Bind lifecycle might not work correctly, because of many edge cases, so it would have to be omitted. Btw have you seen the docs about file upload in Hydro? |
Why whould sending the from break Bind lifecycle? Would you consider that feature if it would not break anything existing? For the current use case, I am not building app it from scratch, but adapting existing forms and do not have the time to rewrite everything to use bindings. It's much faster to continue processing form data while enjoying Hydro. |
There were some edge-cases, like:
So it seems these issue can be handled. But I still think this functionality should be triggered only with a flag via attribute, so it's an explicit behaviour, since by default fields should be synced using bind. |
To solve nested components issue, it seems like we would have to clone the component DOM internally, remove all the nested components and then read the FormData. |
The question was raised here how to acquire form content without hydro bind, the actual answer was that it is for now not possible.
For my app that was a stopper, it requires to read multi-part form data: fields along with uploads.
Hydro core is already ready to support that with a really small addition.
Solved this in my fork, will add a PR for the ability to send/read/bind/validate multi-part form data upon submit.
The text was updated successfully, but these errors were encountered: