Question Programmatically resetting a form

njsokalski

Well-known member
Joined
Mar 16, 2011
Messages
102
Programming Experience
5-10
I have a form on my page that I want to reset after it is submitted. I am trying to use the JavaScript Form.reset(); method to do this, but it doesn't seem to be working. I would just resort to manually setting the value of each control, but this would not work because my page hase a FileUpload control on it, which is readonly. What am I doing wrong? I am currently using the following code at the end of the event handler to add the JavaScript:

Me.ClientScript.RegisterStartupScript(Me.GetType(), "resetform", "Document.forms[0].reset();", True)

Any help would be appreciated. Thanks.
 
JavaScript's document variable won't work with an upper case D, atleast in the quick Document.write('.'); test I wrote, try changing that.
 
Back
Top