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
I have found that when adding a multi-checkbox 'choice' to a Form class it fails to bind when there are multiple values. Only plain string data parses out correctly.
for example, I have in a Kris\LaravelFormBuilder\Form extension class:
This results in a string ["heroin","alcohol", "cocaine"] (a simple json string) saved to the database when all boxes are checked.
However, any multiple selected fields do not properly bind/display when the data from the Eloquent Model is read back into the form using the 'mode' option.
To get around this problem, I had to resort to pulling any multi-select items out into the form controller as an addendum using "addAfter" so I could hard code the 'selected' option processing the string with json_decode.
Hi Kris,
I have found that when adding a multi-checkbox 'choice' to a Form class it fails to bind when there are multiple values. Only plain string data parses out correctly.
for example, I have in a Kris\LaravelFormBuilder\Form extension class:
This results in a string
["heroin","alcohol", "cocaine"]
(a simple json string) saved to the database when all boxes are checked.However, any multiple selected fields do not properly bind/display when the data from the Eloquent Model is read back into the form using the 'mode' option.
To get around this problem, I had to resort to pulling any multi-select items out into the form controller as an addendum using "addAfter" so I could hard code the 'selected' option processing the string with json_decode.
Should the parsing of multi-selected value work "automatically" as well in the binding process? Is there something I missed in saving the data?
Thanks!
The text was updated successfully, but these errors were encountered: