Hello.
I need to implement this (Limit Textarea) code into my "Gift Certificate) site page (http://www.MyStore.com/index.php?main_page=gv_send):
Here is preview of how it works:
http://www.yaldex.com/FSForms/LimitTextarea.htm
I am trying to give customers a feed back on how many characters they have typed in the Gift Certificate Personal Message Field... I put a warning on the page (200 characters limit), but they message just gets cut off if they go over the limit (when someone gets a gift certificate via email). All the input fields are implemented in the image on Custom Designed Gift Certificate HTML Page, customers are able to print it out from they email).
CODE:
<body>
<script language="javascript" type="text/javascript">
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}
// End -->
</script>
<!-- textCounter() parameters are: text field, the count field, max length -->
<form name=myform action="YOUR-SCRIPT.CGI">
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br>
<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="125"> characters left</font>
</form>
</body>
-------------------------------------------
I am new to PHP, so I am not quite sure how to implement it on the page or if it is even possible to make it work using javascript...
Has anyone any experience with this??
Any help is appreciated.
Thanks.
Bookmarks