Character count on textarea attribute
Permalink 1 user found helpful
Hi I need to limit the user to a maximum amount of characters in a textarea attribute for a page. What are my options and does anyone know if there is anyway I can do this?
IMHO for that u may use text box...
Is it possible to use a character count on a textbox then? Would you please describe how?
Add the maxlength attribute to a form text element or textarea element.
http://www.w3schools.com/tags/tag_input.asp...
http://www.w3schools.com/tags/tag_textarea.asp...
http://www.w3schools.com/tags/att_input_maxlength.asp...
http://www.w3schools.com/tags/tag_input.asp...
http://www.w3schools.com/tags/tag_textarea.asp...
http://www.w3schools.com/tags/att_input_maxlength.asp...
Hm, it depends on how you are rendering the text area attribute. Also what page are you trying to restrict them on? Is it like a profile or registration page? Or one of the dashboard pages?
It's a dashboard page, when a user is entering the property of a page which in this case is a textbox, I believe it uses tinyMCE?
Hm, it may be possible but with TinyMCE it is definitely not going to be easy. It's also probably going to have strange results because all of the HTML characters that TinyMCE adds will count towards the character limit. For instance:
So honestly, I'm not really sure how you would go about doing this for TinyMCE. I did find this article in the TinyMCE docs:http://www.tinymce.com/wiki.php/TinyMCE3x:How_to_limit_number_of_ch... but I'm honestly not sure how you would go about getting that code in to tinymce just for this one specific text area. Maybe someone else in here will have some more ideas.
//without tinymce (11 chars) Hello World //with tinymce (18 chars) <p>Hello World</p>
So honestly, I'm not really sure how you would go about doing this for TinyMCE. I did find this article in the TinyMCE docs:http://www.tinymce.com/wiki.php/TinyMCE3x:How_to_limit_number_of_ch... but I'm honestly not sure how you would go about getting that code in to tinymce just for this one specific text area. Maybe someone else in here will have some more ideas.
What if I was to use plain text for the text area attribute, would that make things easier?
If you don't need tinymce support, and you're mildly comfortable with your server and PHP (ie, able to install a package manually), you should check outhttp://www.concrete5.org/marketplace/addons/lerteco-advanced-text-a...
It was updated a few months ago to provide max character feedback, but I haven't been able to push those changes back up to the marketplace.
It was updated a few months ago to provide max character feedback, but I haven't been able to push those changes back up to the marketplace.
The code can be found here:https://github.com/jamesshannon/Advanced-Text-Attribute...