DeadlySin3
02-06-2005, 03:13 AM
Hello,
i'm curious as to how I could go about clearing a textarea in a form on submit. A buddy of mine gave me this little snippet; but i've had no luck in getting it to work. Think someone could explain to me what it is i'm doing wrong?
<SCRIPT TYPE="text/javascript"><!--
onload = function() {
tagForm = document.forms["TagItv2"];
tagForm.onsubmit = function() {
/* execute the 'empty textarea' statement 1sec after the click on
submit so the content of the textarea is submited
before deleted */
setTimeout("tagForm[\"tagitpost\"].value = \"\"), 1000");
return true;
};
};//-->// -->
</SCRIPT>
I have the above placed in the head section of my page. TagItv2 is the name of my form and tagitpost is the name of the textarea field. I'm not getting any errors, but the textarea field isn't cleared after the form is submitted. If you need to know anything else that I may have left out please let me know.
Any help with this is greatly appreciated!
i'm curious as to how I could go about clearing a textarea in a form on submit. A buddy of mine gave me this little snippet; but i've had no luck in getting it to work. Think someone could explain to me what it is i'm doing wrong?
<SCRIPT TYPE="text/javascript"><!--
onload = function() {
tagForm = document.forms["TagItv2"];
tagForm.onsubmit = function() {
/* execute the 'empty textarea' statement 1sec after the click on
submit so the content of the textarea is submited
before deleted */
setTimeout("tagForm[\"tagitpost\"].value = \"\"), 1000");
return true;
};
};//-->// -->
</SCRIPT>
I have the above placed in the head section of my page. TagItv2 is the name of my form and tagitpost is the name of the textarea field. I'm not getting any errors, but the textarea field isn't cleared after the form is submitted. If you need to know anything else that I may have left out please let me know.
Any help with this is greatly appreciated!