I have implemented the above javascript into my add link form. It is very simple and gives the users a visual on how many characters they can use and how many characters they have left. You can see it in action at http://www.scriptdragon.com/add.php. You can log in with
Username: test
Password: test
Here is how I did it.
Open themes/yourtheme/add_form.html and find this section (Note: I am using the portaldex theme for this example, so your code may bbe slightly different depending on your theme.):
Code:
<script language="javascript" type="text/javascript" src="<%$tpl_base%>/calendar.js"></script>
<script language="javascript" type="text/javascript" src="<%$tpl_base%>/calendar-en.js"></script>
<script language="javascript" type="text/javascript" src="<%$tpl_base%>/calendar-setup.js"></script>
<script language="javascript" type="text/javascript" src="<%$tpl_base%>/json.js"></script>
<script language="javascript" type="text/javascript" src="<%$tpl_base%>/ajax.js"></script>
and add this directly after it
Code:
<script language="javascript" type="text/javascript" src="<%$tpl_base%>/formtool.js"></script>
Now scroll a few lines down and find this (or similar):
Code:
<label for="description">Description</label>
<textarea id="description" name="description" cols="35" rows="10" style="overflow: auto;"><%$description%></textarea>
and make it look similar to this:
Code:
<label for="description">Description</label>
<textarea id="description" name="description" cols="35" rows="10" style="overflow: auto;" onkeyup="javascript:formtool_count_chars(this.form.elements['description'],this.form.elements['description_limit'],500,true)"><%$description%></textarea>
<div class="inline">
Limit: <input type="text" name="description_limit" size="3" readonly="readonly" value="500" /> Characters
</div>
In the above code change the number 500 (in both locations) to match the maximum characters you want to allow in the field.
No go to http://www.phpinsider.com/php/code/SmartyFormtool/ and download the script and extract it. Upload the javascript file and the edited add_form.html file into the same directory. You are done.
This should only take about 5 minutes to complete. Good luck.