A student in my class brought this to my attention, and I didn't have an explanation for it-- and I couldn't find one after searching.
After clicking the submit button, the reset button does not work. It's as if the browser prevents reset if the resource has been requested via post request.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".dtd">
<script runat="server">
</script>
<html xmlns="">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<fieldset>
<legend>User Form</legend>
<label for="Username"></label>
<asp:TextBox ID="Username" runat="server"></asp:TextBox>
</fieldset>
<asp:Button runat="server" Text="Submit" />
<input type="button" onclick="window.document.forms[0].reset()" value="reset" />
</div>
</form>
</body>
</html>
A student in my class brought this to my attention, and I didn't have an explanation for it-- and I couldn't find one after searching.
After clicking the submit button, the reset button does not work. It's as if the browser prevents reset if the resource has been requested via post request.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<fieldset>
<legend>User Form</legend>
<label for="Username"></label>
<asp:TextBox ID="Username" runat="server"></asp:TextBox>
</fieldset>
<asp:Button runat="server" Text="Submit" />
<input type="button" onclick="window.document.forms[0].reset()" value="reset" />
</div>
</form>
</body>
</html>
Share
Improve this question
asked Jun 29, 2012 at 19:22
ek_nyek_ny
10.3k8 gold badges51 silver badges60 bronze badges
1 Answer
Reset to default 8When you click reset then the entries are reset to the default values. Default values are values which were rendered by the server in the first case it was empty string but after post the posted value. (http is stateless protocol) If you try to edit the posted value then click reset you will see that the originally posted value will be restored.