954,157 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with resetting value in form!

Hi,

I need to reset all the values of elements in my form to empty string. But the problem is that the form can be reset but the variable still holding the value of y previous input.

For exp,
Input 5 value at first time.
Input 2 value at second time. The rest of the 3 field will take the input value I input previously.

Here my reset function:

function resetForm(formId)
{
	var form, elements, elm;
	if(document.getElementById)
		form = document.getElementById(formId)
	else
		form = document.forms[formId];

	form.reset();
	elements = form.elements
	/**
	* Clear default text of text elements
	*/
	for( i=0, elm; elm=elements[i++]; )
	{
		if (elm.type == "text")
		{
			elm.value ='';
		}
	}
}


Help! :'(

raul15791
Junior Poster
102 posts since Jun 2008
Reputation Points: 37
Solved Threads: 7
 

How is this ASP related?

Drew
Junior Poster
166 posts since Apr 2004
Reputation Points: 25
Solved Threads: 7
 

I found a solution already. Thanks anyway... :)

raul15791
Junior Poster
102 posts since Jun 2008
Reputation Points: 37
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You