Set select options edit
How can i set selected options on edit form with this field
if this options are on a table called 'options' and it depends on three table fields: links_follow, links_nofollow and links_sponsored that are boolean fields
Thanks alot
4 Replies
Perhaps you need to use the
getOptionLabelsUsing()
as described in https://filamentphp.com/docs/3.x/forms/fields/select#multi-select(I don't know for sure: I haven't used that feature yet.)
and/or might need to use
->getStateUsing()
to query the additional fields to provide an array of selected values.but getoptionlabel its for show, and i need to select them. I try with default but it doesnt works. And getStateUsing its not a method for select input 😦
You can use afterStateHydrated or formatStateUsing
https://filamentphp.com/docs/3.x/forms/advanced/#field-hydration