function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kristen LundKristen Lund 

How to limit the character count on textarea in Visualforce?

Hello - I'm creating a custom pre-chat page for Live Agent and am field has a limit of 350 characters, however the field on the pre-chat form allows much more than that. How might I limit the field on the visualforce page as well? Current code section below, and help would be much appreciated!
 
<br></br>
   Question: <textarea name='liveagent.prechat:Question' id='question' required="required" placeholder="How can we help?"
   style="background:transparent; vertical-align:top; border:1px solid #000; width:180px; height:108px; font-size: 16px"></textarea><br/>
   <br></br>

 
Best Answer chosen by Kristen Lund
NagendraNagendra (Salesforce Developers) 
Hi Kirsten,

May I suggest you please check with below links from the community forums which will help you further. Hope this helps.

Mark this as solved if it's resolved.

Thanks,
Nagendra

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Kirsten,

May I suggest you please check with below links from the community forums which will help you further. Hope this helps.

Mark this as solved if it's resolved.

Thanks,
Nagendra
This was selected as the best answer
Kristen LundKristen Lund
Thanks, @nagendra! I can't tell you how long I searched for the answer, I did find the second link, but never the first. The key was the maxlength="XXX" and not having this within the style section. I put it right after the placeholder and it worked great. Thanks again!
Onur Kaya 9Onur Kaya 9
You can use html-maxlength="350"