?
Solved

specify elements of a form to clear using reset button

Posted on 2007-07-25
4
Medium Priority
?
167 Views
Last Modified: 2010-04-09
Is there a way to specify what elements of a form are cleared when using a standard reset button?  Can you specify by name what textboxes for example are cleared and the ones not specified will remain intact?
0
Comment
Question by:dale4brumbaugh
  • 2
4 Comments
 
LVL 3

Expert Comment

by:kevbreit
ID: 19570883
Not without javascript.  You can either blank out everything or reset everything to default states.
0
 
LVL 25

Accepted Solution

by:
kevp75 earned 1000 total points
ID: 19570975
put this in between the <head> tags, and make sure you modify it to your actual form name (if your form doesn't have one put it in), and the name of your form fields
<script language="Javascript">
function clearFields()
{
  document.TheNameOfYourForm.TheNameOfYourField.value = "";
}
</script>

then just copy/paste:   document.TheNameOfYourForm.TheNameOfYourField.value = "";

for each field you need cleared...making sure to change the names....

then at you submit button, put:
<input type="button" onclick="javascript:clearFields();" value="Clear" name="btnClear">
0
 

Author Comment

by:dale4brumbaugh
ID: 19571617
exactly what i was looking for.  thank you
0
 
LVL 25

Expert Comment

by:kevp75
ID: 19571656
any time
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question