Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Restricting the length of a textarea
System
Is it possible to restrict the length of a textarea in a dcr, - maxlength only seems to work for text?
Edited by claire on 03/07/02 09:43 AM (server time).
Find more posts tagged with
Comments
JamJamT
You're right, the maxlength only works for text. For textarea you'll have to write your own validation-regex. The following example limits input to a max of 120 characters:
<item name="Blurb">
<label>Blurb</label>
<description>This description will go under the headline link in the intranet main page.</description>
<textarea rows="3" cols="41" wrap="virtual" validation-regex="^.{1,120}$" />
</item>
--Jeff
Migrateduser
Thanks,
That has been very useful, although it doesn't work very well within replicants!
Migrateduser
There's a slight problem with your code. The dot character (.) matches anything but a newline, so the match will fail if the user has hit the return key or if wrap is set to physical. An alternative is to use a character class that will match any space character or any non-space character, a la:
[\s\S]{1,120}
Cheers
Rob Huffstedtler
rob@bagpipe.com