F
Filament13mo ago
Xavi

Set select options edit

How can i set selected options on edit form with this field
Select::make('link_types')
->label(__('Tipos de enlaces'))
->helperText(__('Tipos de enlaces que permites en tus artículos'))
->required()
->multiple()
->options([
'Follow' => 'follow',
'NoFollow' => 'NoFollow',
'Sponsored' => 'Sponsored',
])
Select::make('link_types')
->label(__('Tipos de enlaces'))
->helperText(__('Tipos de enlaces que permites en tus artículos'))
->required()
->multiple()
->options([
'Follow' => 'follow',
'NoFollow' => 'NoFollow',
'Sponsored' => 'Sponsored',
])
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
DrByte
DrByte13mo ago
Perhaps you need to use the getOptionLabelsUsing() as described in https://filamentphp.com/docs/3.x/forms/fields/select#multi-select
DrByte
DrByte13mo ago
(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.
Xavi
XaviOP13mo ago
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 😦
Want results from more Discord servers?
Add your server