Builder schema not being reactive

Hi, I have this: Forms\Components\Builder::make('requirements') ->blocks([ Forms\Components\Builder\Block::make('data') ->schema(function (callable $get) { $type = $get('type'); Log::info($get('type')); }) ->reactive() And: Forms\Components\Section::make() ->schema([ Forms\Components\Select::make('other') ->options(function (callable $get) { Log::info($get('type')); return [$get('type')]; }) ->reactive(), Forms\Components\Select::make('type') ->options(['Option1' => 'Option1']) ->reactive() ->required(), In the Builder Block::make('data'), the Log is empty, but in the Select::make('other'), the Log is Option1. Why? How could I get the info from the select inside the Builder schema? Thanks
2 Replies
awcodes
awcodes4mo ago
Blocks aren’t reactive. They don’t change their “state” they are only there or not. The form fields inside them are reactive. What are you trying to accomplish? Maybe there’s another way to accomplish it.
ffffer.
ffffer.4mo ago
Hi @awcodes , Thanks for the clarification, I'm using data objects for each 'type', so in the Builder, depending on the selected type, I need some fields to be filled in or others. Actually, my blocks looks like: \Components\Builder\Block::make('data') ->label('Features') ->hidden() ->schema(function (callable $get) { $type = $get('type'); $className = $type ? ucfirst($type) . 'BonusData' : null; $classPath = "\App\Data\{$className}Data"; return class_exists($classPath) ? self::getReflection($classPath) : []; }) ->reactive() ->columns(3) This way, as the 'type' select automatically takes the options from the db, simply by adding a new spatie data object we could extend the different fields for each option
Want results from more Discord servers?
Add your server
More Posts
Repeater - Rollback Main record creation if Pivot Table Data insert failedI have an Order and Product pivot relationship. If saving pivot table data fails i want to rollback How to create login sessions after admin loginBefore incorporating Filament my current project had a Login method that created different session sGetting current url in FilamentWhy isn't {{ url()->current() }} in Filament views showing subpage urls in spa mode? I need to get tIs it possible to Collapsible Panel using recordAction()?I would like my user to be able to click anywhere in the row in order to toggle the Collapsible layoCreate a de-CH localization folderI want to create a `de-CH` folder for localization, but I did not manage to find the right path to oTag files uploaded to S3 via FileUploadIs there a way, to tag files, uploaded to Amazon S3 via Filaments `FileUpload::make()`? When I use `Customizing Filament Export ActionHello everyone, I would need some help with an issue I'm facing regarding the export action in FilamLaravel 11 and Filament trouble after installingHaving trouble after installing Laravel 11 and Filament for the first time. Running into problems wCentering Form, Infolist Component with their labels on mobile screenHow does one achieve centering Form and Infolist components including their labels on mobile, curentNew custom login page not working according to documentation. Please helpSure I am forgetting something obvious but cannot see what. I want to create a completely new login