joanzn
11-17-2010, 09:14 PM
I'm trying to have a textbox clear after it has been filled and submitted.
this is my form look....
<form action="" name="webForm" id="webForm">
<div id="title0" class="pageTitle">Enter Student Dropping A Course: </div>
<div id="fieldName">Name: <input type="text" id="fName" name="fName" size="40" maxlength="60" /></div>
<div id="button"><input type="button" value="Add Latest Student To Drop A Course" onclick="addRecord()" /></div>
</form>
Sooo...in my javascript i'm coding it like this but for somereason it's not working
function resetForm() {//clear the value in the txt field
document.getElementsById("fName").value = "";
}
and i have it called from another function here...
function addRecord() {
var old = XMLdoc.getElementsByTagName("studentName")[0]; //Declare var old and set it's value to the elements by tag name
var clone = old.cloneNode(true);
removeWhiteSpaceNodes(clone);
clone.childNodes[0].nodeValue = webForm.elements[0].value; // set clone to value entered by user in text field
XMLdoc.documentElement.appendChild(clone); //append the clone to the document object
displayStudents();
resetForm();....
any help? ..Much thanks Everyone!
this is my form look....
<form action="" name="webForm" id="webForm">
<div id="title0" class="pageTitle">Enter Student Dropping A Course: </div>
<div id="fieldName">Name: <input type="text" id="fName" name="fName" size="40" maxlength="60" /></div>
<div id="button"><input type="button" value="Add Latest Student To Drop A Course" onclick="addRecord()" /></div>
</form>
Sooo...in my javascript i'm coding it like this but for somereason it's not working
function resetForm() {//clear the value in the txt field
document.getElementsById("fName").value = "";
}
and i have it called from another function here...
function addRecord() {
var old = XMLdoc.getElementsByTagName("studentName")[0]; //Declare var old and set it's value to the elements by tag name
var clone = old.cloneNode(true);
removeWhiteSpaceNodes(clone);
clone.childNodes[0].nodeValue = webForm.elements[0].value; // set clone to value entered by user in text field
XMLdoc.documentElement.appendChild(clone); //append the clone to the document object
displayStudents();
resetForm();....
any help? ..Much thanks Everyone!