createOptionForm - item not automatically selected

What I am trying to do: Add new option in select. What I did:
Forms\Components\Select::make('descr_id')
->relationship(name: 'descrizione', titleAttribute: 'descr')
->createOptionForm([
Forms\Components\TextInput::make('descr'),
]),
Forms\Components\Select::make('descr_id')
->relationship(name: 'descrizione', titleAttribute: 'descr')
->createOptionForm([
Forms\Components\TextInput::make('descr'),
]),
//model
public function descrizione()
{
return $this->belongsTo(MalerbaPagamentiDescr::class, 'descr_id','id');
}
//model
public function descrizione()
{
return $this->belongsTo(MalerbaPagamentiDescr::class, 'descr_id','id');
}
My issue/the error: New item is added in the list as expected but not automatically selected.
1 Reply
phphelloworld
phphelloworld2mo ago
Can someone point me in the right direction? Thanks in advance