-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[V4]: Manage checkbox as a boolean in stead of text value #2889
Comments
Do you mind posting a code sample of your example? I assume it's only for the case of single checkboxes? |
closed by 7a08184 |
I'm still getting array value. I've created a dynamic form component where I loop out the fields from an object that I receive from backend. <Field :name="name" as="input" type="checkbox" :value="attrs.attrs.value" /> If I'm changing the :name to a hardcoded string, like :name="'name1' it works as expected: <Field :name="name + '1'" as="input" type="checkbox" :value="attrs.attrs.value" /> |
@olemarius If all the loop iterations have the same name then that's expected behavior. If each checkbox is only related to the iteration's item then you should make the name unique for that item like by appending the index. |
There's only one checkbox in the form, and only one item with that name so I was expecting it to be the same as if I build the form manually rather than generating it based on a json object. |
@olemarius Do you mind creating a minimal reproduction for your issue on codesandbox? could be a bug. |
@logaretm sorry, the issue was on my side. Works as expected now :-) |
Currently checkbox are managed by an array of the selected checkbox.
But this makes hard to save it in the database as booleans and present it again afterwards
I think it would be better to manage it as a boolean and not as a text value
The text was updated successfully, but these errors were encountered: