Restrict textarea to a certain number of characters

Thanks for all the replies Tommy, you have been a great help :). However I still cant get this working lol. Im a complete noob when it comes to php and yii so I cant get that second example converted over, I can get it working in HTML but I cant get it working in php and yii :(.

Now I’ve read the thread from the beginning. :lol:

Were you able to get the first (charcounter) one working?

For a quick test I just pasted the following into my view (in my case the js directory is located one level above application dir)

$cs = Yii::app()->clientscript;


$cs->registerScript('limitText', '$("#'.CHtml::activeId($model, 'mytextarea').'").charCounter(5);');

If still no luck, check for error messages in Firebug Console.


thanks, it work…