ASP.NET Timer Button

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2005
Posts: 50
Reputation: Naters_uk is an unknown quantity at this point 
Solved Threads: 0
Naters_uk Naters_uk is offline Offline
Junior Poster in Training

ASP.NET Timer Button

 
0
  #1
Feb 3rd, 2006
I would like to code my submit web control button with a timer on it. Its suppose to allow submission until time goes up and the button is disabled from submission. Any directions or tutorials on this?
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: ASP.NET Timer Button

 
0
  #2
Feb 3rd, 2006
easiest way is javascript
  1. <html>
  2. <head>
  3. <script language="JavaScript">
  4. <!--
  5. function setDisableButtonTimer(){
  6. disableButtonTimer = setInterval("disableButton()", 5000);
  7.  
  8. }
  9.  
  10. function disableButton(){
  11. document.form1.btnSubmit.disabled = true;
  12. clearInterval(disableButtonTimer);
  13. }
  14.  
  15. -->
  16. </script>
  17.  
  18. </head>
  19. <body onload="setDisableButtonTimer();">
  20.  
  21. <FORM ACTION="test.asp" METHOD="POST" name="form1" >
  22. <SELECT NAME="MyListBox" Size="11" MULTIPLE>
  23. <OPTION VALUE="0">CustomerID
  24. <OPTION VALUE="1">CompanyName
  25. <OPTION VALUE="2">ContactName
  26. <OPTION VALUE="3">ContactTitle
  27. <OPTION VALUE="4">Address
  28. <OPTION VALUE="5">City
  29. <OPTION VALUE="6">Region
  30. <OPTION VALUE="7">PostalCode
  31. <OPTION VALUE="8">Country
  32. <OPTION VALUE="9">Phone
  33. <OPTION VALUE="10">Fax
  34. </SELECT><P>
  35. <INPUT TYPE=submit name="btnSubmit" >&nbsp;&nbsp
  36. <INPUT TYPE=reset>
  37. </FORM>
  38. </body>
  39.  
  40. </html>
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 50
Reputation: Naters_uk is an unknown quantity at this point 
Solved Threads: 0
Naters_uk Naters_uk is offline Offline
Junior Poster in Training

Re: ASP.NET Timer Button

 
0
  #3
Feb 6th, 2006
<!--
function setDisableButtonTimer(){
disableButtonTimer = setInterval("disableButton()", 5000);

}

function disableButton(){
document.form1.btnSubmit.disabled = true;
clearInterval(disableButtonTimer);
}

-->
</script>

</head>
<body onload="setDisableButtonTimer();">


Campkev, are the above the essential parts i need to have in the html page? Also how do i run the script for the ASP.NET web control button since i have to call 2 functions?
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: ASP.NET Timer Button

 
0
  #4
Feb 6th, 2006
here is a whole web page to give you the idea
  1. <html>
  2. <head>
  3. <script language="JavaScript">
  4. <!--
  5. function setDisableButtonTimer(){
  6. disableButtonTimer = setInterval("disableButton()", 5000);
  7.  
  8. }
  9.  
  10. function disableButton(){
  11. document.form1.btnSubmit.disabled = true;
  12. clearInterval(disableButtonTimer);
  13. }
  14.  
  15. -->
  16. </script>
  17.  
  18. </head>
  19. <body onload="setDisableButtonTimer();">
  20.  
  21. <FORM ACTION="test.asp" METHOD="POST" name="form1" >
  22. <SELECT NAME="MyListBox" Size="11" MULTIPLE>
  23. <OPTION VALUE="0">CustomerID
  24. <OPTION VALUE="1">CompanyName
  25. <OPTION VALUE="2">ContactName
  26. <OPTION VALUE="3">ContactTitle
  27. <OPTION VALUE="4">Address
  28. <OPTION VALUE="5">City
  29. <OPTION VALUE="6">Region
  30. <OPTION VALUE="7">PostalCode
  31. <OPTION VALUE="8">Country
  32. <OPTION VALUE="9">Phone
  33. <OPTION VALUE="10">Fax
  34. </SELECT><P>
  35. <INPUT TYPE=submit name="btnSubmit" >&nbsp;&nbsp
  36. <INPUT TYPE=reset>
  37. </FORM>
  38. </body>
  39.  
  40. </html>
Last edited by campkev; Feb 6th, 2006 at 11:05 am. Reason: added code tags
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