daregu
daregu
FFilament
Created by daregu on 10/8/2024 in #❓┊help
Issue with Dynamic Class Application in `TextInput::make`
Hello, I’m encountering an issue with dynamically applying a class in the TextInput::make component of my project. Here’s the code I’m using:
TextInput::make('result')
->numeric()
->required()
->live()
->extraInputAttributes(function (Examen $record, Get $get, $state) {
$positivo = false;
$class = $positivo ? 'bg-green-100' : 'bg-red-100';
dump($class); // For debugging
return ['class' => (string) $class];
}, true)
TextInput::make('result')
->numeric()
->required()
->live()
->extraInputAttributes(function (Examen $record, Get $get, $state) {
$positivo = false;
$class = $positivo ? 'bg-green-100' : 'bg-red-100';
dump($class); // For debugging
return ['class' => (string) $class];
}, true)
The problem is that the class is not applied correctly when it is evaluated dynamically based on the $positivo variable. However, when I use a static class like this:
return ['class' => 'bg-red-600'];
return ['class' => 'bg-red-600'];
It works perfectly. But when I try to dynamically assign the class, it seems that the appropriate class is not applied. Does anyone have any ideas why this happens or how to resolve it? Thanks in advance for your help!
2 replies
FFilament
Created by daregu on 8/7/2024 in #❓┊help
Disabled class not working ON INPUTS
No description
2 replies