Is there away to limt cftextarea by word not characters? I need to limit my form to 250 words. is there a way to do this?

Recommended Answers

I doubt there is anything built in, but you could roll your own. Grab the textarea value, split it on some sort of word boundary (space, etcetera) and validate.

Jump to Post

Worked fine for me. Maybe you've got an error in your code? Also what's your CF version?

Jump to Post

All 8 Replies

I doubt there is anything built in, but you could roll your own. Grab the textarea value, split it on some sort of word boundary (space, etcetera) and validate.

I tried Maxlength="250" validate="maxlength" to limt by characters but it did not work. Im using rich text areas

Worked fine for me. Maybe you've got an error in your code? Also what's your CF version?

Well like I said, there's no reason it should not work. Maybe there's an error in your code. Can you post it?

<div class="grid_12">    
        <cftextarea name="category#accountabilityCategory.id#_successfulComments" class="controlsB" validate="maxlength" maxlength="50">
            #accountabilityCategory.successfulComments#
        </cftextarea>

maxlength should work, but javascript could also work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.