Text input for selectbox
Hi there!
I am still relatively new to Filament, but loving it so far!
I do have a question regarding record creation within a form.
I am rewriting a form in filament, and I am using a select dropdown to populate an address field.
Now in our old application, you would be able to enter text directly in the selectbox, and it would try find that address, otherwise it would add a new address record based on the text entered in the selectbox.
Now by the looks of it, it does not seem like you can enter text directly in filament Select components(unless I am missing something from the docs?)
So my alternative would be to add a add button next the dropdown, and once the user clicks on it, it opens the Address creation modal.
So my question is: Can I change the selectboxto accept text? And if not, how can I open that modal, so that the user can add and save their new address.
Or maybe there is a better way of doing it?
This is my Select field:
$origpersField = Forms\Components\Select::make('ORIGPERS')
->label('From')
->columnSpan($defColSpan)
->options(function (Get $get) {
// Retrieve the selected customer's value
$selectedCustomer = $get('CUSTOMER');
// If a customer is selected, use their value to filter addresses
if ($selectedCustomer) {
return Addresses::where('ACCNUM', '=', $selectedCustomer)->pluck('NAME', 'PLACE')->toArray();
}
// If no customer is selected, return an empty array or default options
return Addresses::pluck('NAME', 'PLACE')->toArray();
})
->required();
Thanks in advance
2 Replies
Solution
Thank you so much!!! I completely missed that