eagle
eagle
FFilament
Created by prouse_ on 1/7/2025 in #❓┊help
Close modal inside afterStateUpdated in form
Let me know if there is anything you'd like me to clarify or improve further!
12 replies
FFilament
Created by prouse_ on 1/7/2025 in #❓┊help
Close modal inside afterStateUpdated in form
use Filament\Forms\Components\Select; Select::make('your_field')
->options([
'option1' => 'Option 1',
'option2' => 'Option 2',
])
->afterStateUpdated(function ($state, $get, $set) {
// Check if the state has a value (i.e., an option is selected)
if ($state) {
// Close the modal when an option is selected
$this->closeModal(); // Trigger your modal close action here
}
});
12 replies
FFilament
Created by prouse_ on 1/7/2025 in #❓┊help
Close modal inside afterStateUpdated in form
Have you ever used this method?
12 replies
FFilament
Created by prouse_ on 1/7/2025 in #❓┊help
Close modal inside afterStateUpdated in form
const handleSelectChange = (e) => { // Your select field logic closeModal(); // Close the modal when an option is selected }; <Select onChange={handleSelectChange}> {/* Options here */} </Select>
12 replies
FFilament
Created by prouse_ on 1/7/2025 in #❓┊help
Close modal inside afterStateUpdated in form
To automatically close the modal when a selection is made in the <Select> field, you can use an onChange event handler for the <Select> field. In this handler, you can trigger the modal close action.
12 replies