Dynamic form - CheckboxList issue
I have a part of a form that is generated automatically based on a template.
A value is selected in the first dropdown list. and the form below is built based on it.
I encountered a problem when after building the form, the CheckboxList field does not work correctly.
If you have any ideas, please let me know 🙏
Solution:Jump to solution
also was reading more on how on this
https://filamentphp.com/docs/3.x/forms/advanced#dynamic-fields-based-on-a-select-option
it did worked but it always fill the data with null, so maybe you can do something there!...
14 Replies
add live to the tabs?!
I would add live to all component just to make sure for testing :),
it seems the statePath not updating correctly in the first time
added live to everything but the problem remained
you can dump or ray it and see the data:
->statePath(fn()=>ray($processorId,$template->id); '';) or convert it to a closure for testing
it was called five times 🤔
also they are not unique!
what is the state path after of the checkboxes the form saved (when it was working correctly in the video)
the state path is always the same
here is the code to reproduce it. could you try it on your side?
https://gist.github.com/aqjw/98515c86bb9c4c360a73533cb0f27c32#file-form-php
not really sure,
the moment I added
all working fine, I did test out side the tabs, but the same
sorter code for testing:
Solution
also was reading more on how on this
https://filamentphp.com/docs/3.x/forms/advanced#dynamic-fields-based-on-a-select-option
it did worked but it always fill the data with null, so maybe you can do something there!
the sorter doesn't work for me either
problem solved. it was necessary to add
afterStateUpdated
as shown in the docs