F
Filament•7mo ago
core

->maxLength() not working on textinput

Forms\Components\TextInput::make('note')->maxLength(2)
Forms\Components\TextInput::make('note')->maxLength(2)
this is not validating
7 Replies
Dennis Koch
Dennis Koch•7mo ago
We need some more info 🤷🏼‍♀️
Expecto Patronum
Expecto Patronum•7mo ago
What error did you get?
core
coreOP•7mo ago
i get no message/error, followed the docs. expected behaviour : get message that I exceeded the max length. this is inside a relationsmanager form
Expecto Patronum
Expecto Patronum•7mo ago
Can you show your code? Maybe can share the file here to debug
awcodes
awcodes•7mo ago
->maxLength() adds the maxlength attribute to the input meaning the user can’t type more than two characters. It does add the validation as well but since the input is maxed at two it will not trigger an error. If that is not the behavior you want then you’ll need to use ->rules() instead.
core
coreOP•7mo ago
the input still lets me add more than the max so that is weird
awcodes
awcodes•7mo ago
That is very weird. At the least it should trigger a browser validation error if it doesn’t act in accordance with the expected behavior.
Want results from more Discord servers?
Add your server