Skip to main content
Inspiring
August 15, 2013
Answered

CF8 for cftextarea maxlentgth is not working

  • August 15, 2013
  • 2 replies
  • 1466 views

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 has been closed for replies.
    Correct answer GreenGoneMad

    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.

    2 replies

    Priyank Shrivastava.
    Community Manager
    Community Manager
    August 15, 2013

    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

    Thanks,Priyank Shrivastava
    Inspiring
    August 15, 2013

    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?

    GreenGoneMadAuthorCorrect answer
    Inspiring
    August 15, 2013

    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.

    Participating Frequently
    August 15, 2013

    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