How to populate multi select list with default selected values
I have this multiple select form field where I load the options and try to set the default values:
The
default
method does not seem to work. It does not show any selected options. As far as I know I should use the default
option to set the default selected values. As you can see in the image I attached the available options (up) and the default values (down) should match.6 Replies
Is this on Edit or Create?
default()
is for Create onlyOn the edit page
Hmmm ok, which one should I use on the edit page?
Since your model already was saved there is no default anymore. You can use
mutateDataBeforeFill
to fill the form with default dataWill try that! Thanks
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/edit#customizing-data-before-filling-the-form
Is this the documentation about the method you mentioned?
I tried to do so using this code, but it seems like
mutateRecordDataUsing
is not triggered:
Ah I found it, nvm thanks 😄