eagle
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
}
});
->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
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