Skip to main content
Inspiring
Aug 15, 2013 1:01 PM UTC
Answered

CF8 for cftextarea maxlentgth is not working

Hi,

I'm using CF8 and this is my code

<cftextarea id="summary" name="summary" rows="5" cols="80" maxlength="300" required="yes" validate="noblanks" message="You must enter summary." />

It is not working. Am I doing anything wrong?

Thanks

Joe Green

    This topic is closed to new replies. Start a new post to keep the conversation going.
    GreenGoneMadCorrect answer
    Inspiring
    Aug 15, 2013 2:42 PM UTC

    This script doesn't work with cftextarea. Got a love Coldfusion.


    function limitText1(limitField,  limitNum) {     if (limitField.value.length > limitNum) {         limitField.value = limitField.value.substring(0, limitNum);         alert("Character limit exceeded - please reduce the length of description.");     } }  and   onKeyDown="limitText1(this.form.summary,300);  Works finally.

    8 replies

    Priyank Shrivastava.
    Inspiring
    Aug 15, 2013 1:26 PM UTC

    Hi Joe,

    Can you be more specifc about this issue, what is it that not woking and is it not validating the maxlength.

    Try and use validate="maxlength"

    Thanks,

    Priyank

    Translate
    Thanks, Priyank Shrivastava
    Inspiring
    Aug 15, 2013 1:28 PM UTC

    Yes now it is working with validate="maxlength".

    Is there a way to stop user from typing more characters than say 300 or show char counter?

    Translate
    p_sim
    Participating Frequently
    Aug 15, 2013 1:51 PM UTC
    Participating Frequently
    Aug 15, 2013 1:14 PM UTC

    What do you mean by 'not working'?  Does nothing appear?  Are you able to type in more than 300 characters?  Do you get a javascript error?  ... etc

    Translate