how you render button without click it

public function getActions(): array { $formFilled = $this->isFormFilled(); return [ Actions\CreateAction::make() ->label('Generate from ChatGPT') ->action(fn () => $this->fillFormFields1()) ->disabled($formFilled) ->color($formFilled ? 'success' : 'secondary') // ->color('success') ->outlined() ]; } protected function isFormFilled(): bool { $requiredFields = ['type', 'difficulty_level']; foreach ($requiredFields as $field) { if (empty($this->data[$field])) { return false; } } // $again=$this->make(); return true; } This is my code write in filament/resources/materialresources/page/creatematerial.php file i want when two fill are fillup then the button color will change so i write this logic but when i fill the field then color was not change but after fill the field when i click on button then only the color was change. so i try to fix it can you help me in it
Solution:
their is a reactive() function in filament
Jump to solution
3 Replies
Hiz
Hiz10mo ago
Maybe you could try to add this:
$formFilled = $this->isFormFilled();
$formFilled = $this->isFormFilled();
part a mount() function instead of the getActions()
Solution
seetakanta
seetakanta10mo ago
their is a reactive() function in filament
seetakanta
seetakanta10mo ago
i use that in materialreources .php file now it work
Want results from more Discord servers?
Add your server
More Posts