Hi,
I want to limit the characters in the textarea to 400...
i found this script but i dont know how to implement in my script...
this is the script:
<html><head>
<title>(Type a title for your page here)</title>
<script language=JavaScript>
<!--
function check_length(my_form)
{
maxLen = 50; // max number of characters allowed
if (my_form.my_text.value.length >= maxLen) {
// Alert message if maximum limit is reached.
// If required Alert can be removed.
var msg = "You have reached your maximum limit of characters allowed";
alert(msg);
// Reached the Maximum length so trim the textarea
my_form.my_text.value = my_form.my_text.value.substring(0, maxLen);
}
else{ // Maximum length not reached so update the value of my_text counter
my_form.text_num.value = maxLen - my_form.my_text.value.length;}
}
//-->
</script>
</head>
<body>
<form name=my_form method=post>
<textarea onKeyPress=check_length(this.form); onKeyDown=check_length(this.form); name=my_text rows=4 cols=30></textarea>
<br>
<input size=1 value=50 name=text_num> Characters Left
</form>
</body>
</html>
and my script is:
<?php
class FormTextarea extends FormElement {
var $cols;
var $rows;
var $value;
function FormTextarea($f) {
$this->setCaption($f);
$this->setName($f);
list($rows, $cols) = $f ? explode('x',$f) : array(10,50);
$this->rows = intval($rows);
$this->cols = intval($cols);
$this->value = $f;
}
function getRows() {
return $this->rows;
}
function getCols() {
return $this->cols;
}
function getValue() {
return $this->value;
}
function render() {
return '<textarea class="fields" name="'.$this->getName().'" id="'.$this->getName().'" rows="'.$this->getRows().'" cols="'.$this->getCols().'"'.$this->getExtra().'>'.$this->getValue().'</textarea>';
}
}
?>
Please help me with this... i really do not know php.
English is not my language... so sorry for mistakes.