Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"RESET"-button not working in Client-Script

Status
Not open for further replies.

IL

Programmer
Jan 7, 2002
15
SE
Hello, again

have two .asp pages.
one client-script and one server-script.
I send session variables to a server-script for
validation, if there is an error, the user is
brought back to page one with all correctly filled
out data retained.
Now, the session variables are working, but the
<INPUT TYPE=&quot;RESET&quot;...and so on...> Button-function
doesn't work. So do I need to put a session.abandon
or something like that somewhere. I think maybe the
server keeps submitting the values continously
to the client-script and maybe because of this the
the RESET is not working.
How do I get around this ?

IL
 
Are you saying the reset button doesn't clear the fields that have been populated automatically from your sessions? This will happen because the reset function resets the fields' values to the values specified in the code (in your case probably <.... value=&quot;<%=session(&quot;whatever&quot;)%>&quot;...>

To clear the fields you can do it client side with javascript or vbscript, otherwise you'd have to resubmit the page and clear the form values (or session.abandon).

For client side try:

<input type=&quot;button&quot; name=&quot;reset&quot; value=&quot;Reset&quot; onClick=&quot;ResetForm()&quot;>

Then in the head section:

<script type=&quot;text/javascript&quot;>
function ResetForm() {
document.formname.inputname.value = '';
document.formname.inputname2.value = '';
document.formname.inputname3.value = '';
document.formname.inputname4.value = '';
}
</script>

I hope I didn't misunderstand what you want. Incidentally, you could do the above javascript more efficiently by looping through all your form elements, but my javascript knowledge isn't the best.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top