Dynamic fields based on a select option with Tabs

My problem is as follows: On the create page, when I select a product type on the "Default TAB" tab, the form associated with that product type should load on the "Data TAB" tab. This works on the create page, the data is entered insert the database. However, when I open the editing page, even though the product type is loaded back from the database, the "Data TAB" on the second tab remains empty – the corresponding form is not loaded. In fact, nothing is loaded. What could be the solution? Tab::make('Default TAB') ->schema([ Select::make('type_id')->label(__('Product Type'))->required()->searchable() ->options(\App\Models\List\ProductType::orderBy('id', 'asc')->pluck('name', 'id')->toArray()) ->live(), ])->columns(4), Tab::make('Data TAB') ->schema(fn (Get $get): array => match ($get('type_id')) { default => [], '1' => [ProductDataContactLensForm::make('cldata')->columns(4)], '3' => [ProductDataSunGlassForm::make('sgdata')->columns(4)], '5' => [ProductDataSpectacleFrameForm::make('sfdata')->columns(4)], }),
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server