Closed KES777 closed 2 months ago
Thanks for the feedback. I don't think that this make any sense.
It is intuitiv enough that when an element have no name that it cannot be in the output, because the name is the key. This is also default behaviour from any other existing library or even the native FormData
.
This don't need to be documented because it simple is self-explanatory that a missing "name" attribute result in skipped in the output. Even if it is not clear at first glance because someone is new to forms, you see it when you first use the function.
If elements does not have name, then its value is skipped. It would be nice to have this documented.
Even better a new configuration options could be provided which controls this. Eg. 'includeUnnamed = "custom_key_store_unnamed_inputs"'. If this options is set, then all unnamed inputs could be stored under "custom_key_store_unnamed_inputs" key as array.
Though it could conflict with "skipEmpty". If it is true, then it will not be possible to understand if the value "first input" come from first element or second (when first is empty). Or "skipEmpty" could be ignored for unnamed inputs and always return in values for all elements.