Problem with resetting value in form!

Reply

Join Date: Jun 2008
Posts: 89
Reputation: raul15791 is an unknown quantity at this point 
Solved Threads: 7
raul15791 raul15791 is offline Offline
Junior Poster in Training

Problem with resetting value in form!

 
0
  #1
Nov 23rd, 2008
Hi,

I need to reset all the values of elements in my form to empty string. But the problem is that the form can be reset but the variable still holding the value of y previous input.

For exp,
Input 5 value at first time.
Input 2 value at second time. The rest of the 3 field will take the input value I input previously.

Here my reset function:
  1. function resetForm(formId)
  2. {
  3. var form, elements, elm;
  4. if(document.getElementById)
  5. form = document.getElementById(formId)
  6. else
  7. form = document.forms[formId];
  8.  
  9. form.reset();
  10. elements = form.elements
  11. /**
  12. * Clear default text of text elements
  13. */
  14. for( i=0, elm; elm=elements[i++]; )
  15. {
  16. if (elm.type == "text")
  17. {
  18. elm.value ='';
  19. }
  20. }
  21. }

Help!
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 167
Reputation: Drew is an unknown quantity at this point 
Solved Threads: 7
Drew's Avatar
Drew Drew is offline Offline
Junior Poster

Re: Problem with resetting value in form!

 
0
  #2
Nov 27th, 2008
How is this ASP related?
Drew Gauderman
ASP / MSSQL Coder
http://www.iportalx.net - My ASP Portal
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 89
Reputation: raul15791 is an unknown quantity at this point 
Solved Threads: 7
raul15791 raul15791 is offline Offline
Junior Poster in Training

Re: Problem with resetting value in form!

 
0
  #3
Nov 27th, 2008
I found a solution already. Thanks anyway...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC