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
Fix: Omit hidden input before checkbox group (#314)
Omit hidden 'reset' input that appears before checkbox group if any checkboxes are checked.
## What changed?
- Better preserve DOM order of form elements better when building form data.
## Why make these changes?
A hidden input before a checkbox group can be used to reset the value if all checkboxes are unchecked.
However, if checkboxes are checked, then the hidden input should be effectively ignored.
Plug/Phoenix can handle this if the field values arrive in DOM order.
In forms like:
```html
<input type="hidden" name="list" value="" />
<input type="checkbox" name="list[]" value="one" />
<input type="checkbox" name="list[]" value="two" />
```
PhoenixTest previously collected controls by selector category and stored `FormData` in a map. That lost DOM order and collapsed repeated field names, which could cause the hidden scalar entry to interfere with the checkbox array payload.
This commit is only a partial improvement. The ideal solution would be to submit form data in the exact DOM order a browser would, end to end.
0 commit comments