F
Filament16mo ago
Abi

Limit number of items in TagsInput

Is there a way to limit the number of items on the TagsInput
5 Replies
Abi
AbiOP16mo ago
any advice on this please?
K R A T O S
K R A T O S16mo ago
Hey @Abishek . You can maybe check how many tags you have in the field by using Filament\Forms\Get . For example: You can have a afterStateUpdated() on your TagsInput and then use Filament\Forms\Get to get the contents of the field. Then you can validate it however you want and inject the TagsInput again in the callback and then update it to have a info displayed above the field saying something like Only 2 tags allowed or something like that.
Abi
AbiOP16mo ago
ok, let me try that. was hoping something similar like a method I may be missing to limit the number of items on the control.
K R A T O S
K R A T O S16mo ago
I checked the docs and I dont think there is a function like ->max()
K R A T O S
K R A T O S16mo ago
Something like this
Want results from more Discord servers?
Add your server