Alberto
Alberto
FFilament
Created by Alberto on 4/16/2025 in #❓┊help
Action Notify from onClick
I want to copy the content of a input field. And it works, but i want to notify it. The dispatch is not working. Maybe i'm over complicating it.
TextInput::make("sis")
->label("SIS")
->columnSpan(3)
->required()
->suffixAction(
Action::make("copy")
->icon("heroicon-m-clipboard-document")
->tooltip("Copiar")
->extraAttributes([
"x-on:click" => new \Illuminate\Support\HtmlString("
const wrapper = \$el.closest('.fi-input-wrp');
const input = wrapper?.querySelector('.fi-input');

if (input) {
navigator.clipboard.writeText(input.value);
\$dispatch('notify', { type: 'success', message: 'Copiat!' });
} else {
console.log('Input not found');
}
"),
])
)
TextInput::make("sis")
->label("SIS")
->columnSpan(3)
->required()
->suffixAction(
Action::make("copy")
->icon("heroicon-m-clipboard-document")
->tooltip("Copiar")
->extraAttributes([
"x-on:click" => new \Illuminate\Support\HtmlString("
const wrapper = \$el.closest('.fi-input-wrp');
const input = wrapper?.querySelector('.fi-input');

if (input) {
navigator.clipboard.writeText(input.value);
\$dispatch('notify', { type: 'success', message: 'Copiat!' });
} else {
console.log('Input not found');
}
"),
])
)
2 replies
FFilament
Created by Alberto on 3/27/2025 in #❓┊help
Force select value based on a toggle option
I have a select value with three possible values (0 ,1, 2) ,next to it I've a toggle, when the toggle is true, the select value must be 2. So on my Toggle I'm using ->reactive()->afterStateUpdated( to update the select value, and on my select I'm using disabled(fn ($get) => $get('my_toggle') === true). The problem is that now the select values does not gets submitted, so the value is never updated. Is there a "pretty" way to do it ? As there's no readonly method on Select. I could use a hidden field, and update it, but looks messy. Thnx for your help!
6 replies
FFilament
Created by Alberto on 3/27/2025 in #❓┊help
Combine more than one field in a Filament Resource recordTitleAttribute
Is there a way to call a function to instead reading just an attribute? So instead of protected static ?string $recordTitleAttribute = 'title; Using something like fn ($record) return "{$record->title} / {$record->subtitle}"
4 replies