How to set tags to a TagsInput using $set

Hello i would like some help to set tags using $set i have tried :
$set('tags', 'a,tag');
$set('tags', ['a','tag']);
$set('tags', ['tag'=>'tag']);
$set('tags', 'a,tag');
$set('tags', ['a','tag']);
$set('tags', ['tag'=>'tag']);
as show in the image , it shows as if the input is not empty but not displaying anything, thank you for the help
No description
8 Replies
LeandroFerreira
in the create form, you can use ->default(['a', 'b'])
omar abdou
omar abdouOP2d ago
as you can see in tthe image , i added an action on the right , i am setting the tags from that action
LeandroFerreira
try this
TagsInput::make('tags')
->suffixAction(Action::make('add')
->icon('heroicon-o-user-plus')
->form([
TextInput::make('name')
])
->action(function (array $data, Page $livewire) {
$livewire->data['tags'][] = $data['name'];
}))
TagsInput::make('tags')
->suffixAction(Action::make('add')
->icon('heroicon-o-user-plus')
->form([
TextInput::make('name')
])
->action(function (array $data, Page $livewire) {
$livewire->data['tags'][] = $data['name'];
}))
omar abdou
omar abdouOP14h ago
Failed
Property [$data] not found on component: [app.filament.admin.resources.meeting-resource.pages.manage-meetings]
Property [$data] not found on component: [app.filament.admin.resources.meeting-resource.pages.manage-meetings]
No description
LeandroFerreira
LeandroFerreira14h ago
$livewire->mountedActionData ?
omar abdou
omar abdouOP14h ago
$livewire->mountedActionsData['tags'][] = $data['employee_id']; does not throw an error but tags are not set , the input has no value
LeandroFerreira
LeandroFerreira11h ago
Share the whole code on gist please
omar abdou
omar abdouOP10h ago
Gist
example.php
GitHub Gist: instantly share code, notes, and snippets.

Did you find this page helpful?