473,388 Members | 1,234 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Form reset method

I need to reset a form to its original value using onclick rather than the
Reset button. So, I have:

<input type="button" name="reset" id="reset" value="Reset"
onclick="form1.reset();"> where the id of my form is "form1".

This gives the error "Object doesn't support this property or method".

Please advise.

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Mar 29 '06 #1
2 5209
Roger Withnell wrote on 30 mrt 2006 in comp.lang.javascript:
<input type="button" name="reset" id="reset" value="Reset"
onclick="form1.reset();"> where the id of my form is "form1".

This gives the error "Object doesn't support this property or method".


This:

===========================
<form name=form1>
<input>
</form>

<input type="button" value="Reset"
onclick="form1.reset();">
=============================

works fine in IE,
in other browsers you would probably have to
change form1.reset() to:

document.forms['form1'].reset()

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 29 '06 #2
Roger Withnell said on 30/03/2006 8:11 AM AEST:
I need to reset a form to its original value using onclick rather than the
Reset button. So, I have:

<input type="button" name="reset" id="reset" value="Reset"
onclick="form1.reset();"> where the id of my form is "form1".

This gives the error "Object doesn't support this property or method".


Because by giving your button either a name or id of 'reset' (you've
done both) you hide the native reset method of the form - form1.reset is
now a reference to the button named 'reset', not the reset method. And
HTML buttons don't have a reset method.

Your button doesn't need an ID or name, so just remove it. If you must
give it a name or id, use something else like 'resetButton' - anything
but 'reset' (or 'Reset').
--
Rob
Mar 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: iwasinnihon | last post by:
I don't usually like to do this, but I need help. I have gone over this code and cannot figure out why it doesn't work. First of all it doesn't check to see if you have filled in the required...
9
by: Ken | last post by:
How can I reset the initial form variables that are set with session statements when clicking on a button? I tried this but the function was not called: <?PHP function reset_form($none) {...
13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
1
by: Joe Bloggs | last post by:
I have a form which includes a checkbox field. I need to add a reset, I add a HTML reset it works fine before I submit the form but not after. I know I must add some code to reset the checkbox on...
4
by: Lee Chapman | last post by:
Hi, Can anyone tell me why in the code below, the call to ClearChildViewState() has no effect? To paraphrase the code: I'm using view state. I have a textbox and a submit button (and a label...
10
by: jaxent | last post by:
Does anyone know why IE gives the error "'document.myForm.dummy' is null or not an object" on the following page? Firefox does what I expect, creates a text box and writes "hello" in it. <html>...
4
by: Matt | last post by:
I have the following in a page and I am trying to update a record on the next page but for some reason the form data is not carrying over. Any ideas why? <form name=nxtlupdate method=post...
7
by: Chuck Anderson | last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a...
4
SHOverine
by: SHOverine | last post by:
I have a 3-part form that I am having trouble with. First part is to select the user group and the week and year that I want to submit results for, this calls the elements that I want to update. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.