Hi all!
I've got a text area that uses Javascript to control the length of the user input to 255 characters.
The value of that text area is stored in a session variable so that the user can go back to that page to review their input.
However, when the user returns to the page, the text area is empty.
Could anyone please tell me where I've gone wrong?
Here's the Javascript code:
<SCRIPT LANGUAGE="JavaScript">
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
</script>
and here's the HTML and PHP for my text area:
<textarea name="positive" cols="80" rows="3" id="positive" VALUE="<?PHP echo $_SESSION['answer']['positive'];?>" onKeyDown="textCounter(this.form.positive,this.form.remLen,255);" onKeyUp="textCounter(this.form.positive,this.form.remLen,255);"></textarea>
<input readonly type=text name="remLen" size="3" maxlength="3" value="255">
Thanks a lot in advance for your help!