Menu icon Foundation
Abide Max Character Validation

Hello, I'm currently learning how to implement abide for validation on my forms. I could use some help creating a custom validation pattern to set a max character count on a text input fields. Right now I have a required field and valid email error message so I require separate error message stating max character has been met. 

Any advice or direction would be great... having issue sorting out how to achieve this custom pattern. 

abideformvalidationmax character

Hello, I'm currently learning how to implement abide for validation on my forms. I could use some help creating a custom validation pattern to set a max character count on a text input fields. Right now I have a required field and valid email error message so I require separate error message stating max character has been met. 

Any advice or direction would be great... having issue sorting out how to achieve this custom pattern. 

Kai Falkowski almost 3 years ago

Hi Trevor,

you can simply add a custom pattern to the specific input by adding a regex in the attribute:
... pattern="^.{1,5}$" ... (replace 5 with the desired max value)

But if you only wanna limit the max characters, you can also use the native 'maxlength' attribute:
... maxlength="5" ...