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
Currently file inputs are ignored – this was because handling File objects is usually very application-specific and validating them can be their own nightmare.
However, I've realized that the validation aspect is a moot point because you (the user) pass in your own validation rules, and formee will just respond to what your Functions & RegExps return values.
The only remaining "gotcha" is that the serialized return can no longer be passed directly into currentfetch() requests if you have a File present. With the current formee version, tge data would just not include the file(s), making it safe for basic POST requests.
In order to upload files now, you have to manually check the DOM for values within your file inputs, and then upload them in a separate POST request or transform the current, single POST into a multipart request.
If formee were to serialize & validate file inputs, the only difference is that you'd have to check against the serialized data instead of adding to the serialized data. The cause for concern is that you may unknowingly attempt to send basic POST requests with multi-part bodies.
Either way, you have to formulate your outgoing HTTP request properly.
Edit: I should clarify that an object will still be returned, not a FormData instance.
Another (existing) shortcoming is that asynchronous validation methods won't be awaited. This is true for all validators currently, too, but may be highlighted with file validation.
What do you think? Should formee serialize & validate file inputs?
The text was updated successfully, but these errors were encountered:
Currently file inputs are ignored – this was because handling
File
objects is usually very application-specific and validating them can be their own nightmare.However, I've realized that the validation aspect is a moot point because you (the user) pass in your own validation rules, and
formee
will just respond to what your Functions & RegExps return values.The only remaining "gotcha" is that the serialized return can no longer be passed directly into current
fetch()
requests if you have aFile
present. With the currentformee
version, tge data would just not include the file(s), making it safe for basic POST requests.In order to upload files now, you have to manually check the DOM for values within your file inputs, and then upload them in a separate POST request or transform the current, single POST into a multipart request.
If
formee
were to serialize & validate file inputs, the only difference is that you'd have to check against the serialized data instead of adding to the serialized data. The cause for concern is that you may unknowingly attempt to send basic POST requests with multi-part bodies.Edit: I should clarify that an object will still be returned, not a FormData instance.
Another (existing) shortcoming is that asynchronous validation methods won't be awaited. This is true for all validators currently, too, but may be highlighted with file validation.
What do you think? Should
formee
serialize & validate file inputs?The text was updated successfully, but these errors were encountered: