Dynamically Populate Batch Number Select Based on Product Selection in Filament
Hi everyone,👋
I’m trying to populate a Select field for batch_number based on the selected product_id in Filament. I want the batch_number select to be dynamically updated after a product is chosen. Here’s the code I’m working with:
The issue is that the batch_number select isn't being populated after the product is selected. What am I missing or doing wrong? How can I make the batch_number field update dynamically based on the product selection?
this is the value of the variable $optionsForBatchNumberSelect->toArray():
3 Replies
I found the solution here: https://github.com/filamentphp/filament/discussions/9977#discussioncomment-7721194. Thanks for your help!
GitHub
Add state of field to an array to use in select options · filamentp...
I have this: TextInput::make('step_field_name') ->label('Field Name') ->live() ->afterStateUpdated(function (string $state) { $field_names[] = $state; }) and trying to pass...
Your setting sets the values i.e. defaults, you need to get the options based on the parent select i.e. product_id
to