F
Filament10mo ago
Eren

Select add data without leaving page

Repeater::make('product_types')
->relationship('product_types')
->schema([
Forms\Components\Select::make('product_type_id')
->label('Product Type')
->createOptionForm([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),
]) ->searchable()
->columnSpanFull(),

]),
Repeater::make('product_types')
->relationship('product_types')
->schema([
Forms\Components\Select::make('product_type_id')
->label('Product Type')
->createOptionForm([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),
]) ->searchable()
->columnSpanFull(),

]),
2 Replies
Eren
ErenOP10mo ago
When i try to add it open modal window but error like this Select field [data.product_pricing.record-1.product_types.3353ebcb-797f-4cf1-8643-f4e3c4b0f38b.product_type_id] must have a [createOptionUsing()] closure set. as you see i remove relationship from select but when i add relationship to select. I got an error like this Call to a member function getModel() on null Can not open modal window at all.
Dennis Koch
Dennis Koch10mo ago
The first error tells you what to do. The second one is because you try to use relationship but didn’t provide a model to your form. $form->model(…). Should be documented.

Did you find this page helpful?