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! :'(

Recommended Answers

All 2 Replies

How is this ASP related?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.