Home
TeamSite
char max in textarea?
nico
Does anyone know how to make a textarea have a max character limit?
thanks,
Nico
Find more posts tagged with
Comments
mogoo
In your datacapture.cfg, add a validation-regex attribute to your textarea tag. It will look something like this:
<textarea wrap="virtual" cols="50" rows="3" validation-regex="^[\s\S]{1,1000}$">
(1000 char being the maxlength in this example)
maureen
nico
So does this just cut off the characters sent to the dcr? Because it does not seem to be stopping me from typing an unlimited amount of characters in the textarea field in my dct. I know i could use a maxchar on a <text/> field but i've been instructed to make it work on a <textarea/> field. Ideas?
Thanks,
Nico
nico
also does that regex take into account space's, punctuation and numbers?
mogoo
Nico-
This works fine for us, with TS 5.0. Yes, you can type beyond the limit... but when the user tries to preview it, they'll get a message that there's fields with invalid values, and it will turn the field name red. We've stated in our description when a certain entry cannot exceed X number of characters.
-maureen
Migrateduser
Yes,
It says match the beginning of the string (^), followed by 1 to 1000 whitespace(space, tab, newline)-or-non-whitespace(anything that's not a space, tab, or newline) characters, followed by the end of string.
Cheers
Rob Huffstedtler
rob@bagpipe.com
aces
My textarea just go on until I hit the return key. Is there a way to make the textarea wrap at the end.
Adam Stoller
Set the textarea 'wrap' attribute to either "virtual" or "physical"
--fish
(Interwoven Senior Technical Consultant)