FilamentF
Filament2y ago
MZX

Automatically set input field through the input of another field?

I have a form in the package resource. the package has a name, and a price. I have defined enums for the package names. When the user selects the package, i want the price field to be automatically set to the package the user chose. How do I go about it? I did see conditional querying docs but just can't seem to figure it out. Here's the code

Forms\Components\Select::make('name')
                    ->enum(Packages::class)
                    ->options(Packages::class)
                    ->required(),

                Forms\Components\TextInput::make('price')
                    ->label('Price')
                    ->numeric()
                    ->disabled()
                    ->prefix('$')
                    ->required(),
Was this page helpful?