F
Filament13mo ago
Wazza

Set Select Option After createOptionForm

Hey everyone just looking for some advice, how could I set the value of the select option to the newly created on that I have created using the createOptionForm below is my select component
Forms\Components\Select::make('industry_id')
->label('Industry')
->relationship(name: 'industry', titleAttribute: 'name')
->options(
Industry::all()->pluck('name', 'id')
)->createOptionForm([
Forms\Components\TextInput::make('name')
->required(),
])
->live(),
Forms\Components\Select::make('industry_id')
->label('Industry')
->relationship(name: 'industry', titleAttribute: 'name')
->options(
Industry::all()->pluck('name', 'id')
)->createOptionForm([
Forms\Components\TextInput::make('name')
->required(),
])
->live(),
Any help would be great, thank you in advance
1 Reply
Majid Al Zariey
Majid Al Zariey12mo ago
Why are you using the relationship and options together, The default action is for the new created item to be selected
Want results from more Discord servers?
Add your server