words()
Ensure the input contains a specific range of words.
Setup
Attribute: sf-validation="words(MIN_WORDS, MAX_WORDS)"
Ensures that the input contains a specific range of words. This is particularly useful for fields like comments, descriptions, or any input where word count matters.
For example, you can require a user to enter between 5 and 20 words to ensure sufficient detail without overwhelming verbosity.
HTML Example
Webflow Example
Usage Examples
words(0,10)
: Minimum of zero words are allowed, and the maximum number of words can be up to 10.words(5)
: Minimum of 5 words are required, with no restriction on the maximum number of words.
Attribute Configuration
Make sure to add the sf-validation="words(MIN_NUM,MAX_NUM)"
attribute key-pair to valid input types as mentioned above.
Here are some instructions to keep in mind:
The attribute value should follow the format
words(MIN_NUM,MAX_NUM)
orwords(MIN_NUM)
.words()
validation can be paired with native HTML attributes likepattern
.
Last updated
Was this helpful?