If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Reseting the page which has 2 forms

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-27-04, 19:22
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
Reseting the page which has 2 forms

Hi there,

I have a problem here which i cant seem to think how to overcome.
I need to reset the page which contains a few textboxes in one form and a few other textboxes in another form.
My reset button is in the form below.
So if i click the reset button, only the bottom form textboxes and radio combo boxes will be reset and not in the other form.
How to reset all the textboxes and the one whole page which contain 2 forms?
thanx
Reply With Quote
  #2 (permalink)  
Old 01-04-05, 10:26
RhythmAddict RhythmAddict is offline
Registered User
 
Join Date: Dec 2003
Posts: 148
Example:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script>
function Reset()
{
 document.FormName.TextBox1.value = '';
 document.OtherFormName.TextBox2.value ='';
}
</script>		
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="FormName">
<input type="text" name="TextBox1">
</form>

<form name="OtherFormName">
<input type="text" name="TextBox2">
<input type="button" onClick="Reset();" value="Reset">
</form>


</body>
</html>
Write a simple javascript function that fire onClickof your button and clears all the textboxes you want.
Reply With Quote
  #3 (permalink)  
Old 01-04-05, 14:40
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
There is a JavaScript "reset()" function on the form that you can call from the function instead of having to hit every field manually...

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script>
function Reset()
{
 document.FormName.reset();
 document.OtherFormName.reset();
}
</script>		
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="FormName">
<input type="text" name="TextBox1">
</form>

<form name="OtherFormName">
<input type="text" name="TextBox2">
<input type="button" onClick="Reset();" value="Reset">
</form>


</body>
</html>
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #4 (permalink)  
Old 01-04-05, 17:55
RhythmAddict RhythmAddict is offline
Registered User
 
Join Date: Dec 2003
Posts: 148
nice, i was unaware of that :-)
Reply With Quote
  #5 (permalink)  
Old 01-04-05, 18:08
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
ya learn something new every day...
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #6 (permalink)  
Old 01-04-05, 21:26
jaywhy13 jaywhy13 is offline
Registered User
 
Join Date: Dec 2004
Posts: 7
Talking Hey try this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script>
function Reset()
{
for (var loop=0; loop<document.forms.length; loop++)
{
document.form[loop].reset();
}
}
</script>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="FormName">
<input type="text" name="TextBox1">
</form>

<form name="OtherFormName">
<input type="text" name="TextBox2">
<input type="button" onClick="Reset();" value="Reset">
</form>


</body>
</html>
Reply With Quote
  #7 (permalink)  
Old 01-04-05, 22:34
RhythmAddict RhythmAddict is offline
Registered User
 
Join Date: Dec 2003
Posts: 148
michaelfg81, I should hope one of the many solutions we've provided have worked for you?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On