Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Dec 2009
    Posts
    42
    Thanks
    13
    Thanked 0 Times in 0 Posts

    JS Function problem

    Hi,

    In ASP.NET intranet web page have user input. Have 5 check boxes with two attending text boxes for each. The default value for the text boxes is zero and the text boxes are disabled for input. When the user checks a check box the two corresponding text boxes become enabled for input.
    Have two command buttons - Submit for database posting and Cancel. I set the Cancel button with a js window.confirm, uncheck the check boxes, and reset any input values in the text boxes back to zero. When I tested the code the checked check boxes were unchecked and the first text box holding user input was reset to zero value. However, the other text boxes containing user input values were not reset to zero. I altered the sequence of the code - for example - list the check box then its text boxes and so on. I tried listing the text boxes first then the check boxes. These did not resolve the problem - I was thinking linear execution of the code.
    Any suggestions to rememdy this?

    This is the js function:
    function Empty()
    {
    var res=window.confirm("Please confirm cancellation-your input will be cleared");
    if(res==true)
    {
    document.getElementById("chkDVTT").value="";
    document.getElementById("chkLM").value="";
    document.getElementById("chkVMB").value="";
    document.getElementById("chkVEB").value="";
    document.getElementById("chkVUB").value="";
    document.getElementById("txtDVTTRegHrs").value="0";
    document.getElementById("txtDVTTOTHrs").value="0";
    document.getElementById("txtBRLMRegHrs").value="0";
    document.getElementById("txtBrLMOTHrs").value="0";
    document.getElementById("txtVMBRegHrs").value="0";
    document.getElementById("txtVMBOTHrs").value="0";
    document.getElementById("txtVEBRegHrs").value="0";
    document.getElementById("txtVEBOTHrs").value="0";
    document.getElementById("txtVUBRegHrs").value="0";
    document.getElementById("txtVUBOTHrs").value="0";
    }
    }


    Thanks,

    John

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Can we see the HTML aspect of your form elements? Do your elements have an id? Is it your "cancel" button a type="reset" one?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    The syntax to clear a checkbox is

    document.getElementById("chkDVTT").checked = false;

    You can reset the whole form with

    <input type = "button" value = "Reset The Form" onclick = "document.formname.reset()">


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

  • #4
    New Coder
    Join Date
    Dec 2009
    Posts
    42
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Thank you for the correct syntax which I applied. However, the js Function does not perform in the manner I require. I do not believe I want to reset the entire form. The page contains textboxes which carry information from the preceeding page in the load event.

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As _ System.EventArgs) Handles form2.Load
    txtBrProj.Text = Session("ddlRasText")
    txtBrTmRegHrs.Text = Session("txtProjRegHrsAl")
    txtBrTmOTHrs.Text = Session("txtProjOTHrsAl")
    BindGridView()

    Any suggestions to get these textboxes to reset is sorely appreciated.

    John

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,966
    Thanks
    79
    Thanked 4,429 Times in 4,394 Posts
    Answer Kor's question: Show us the HTML--not the ASP.NET code--for the page. Or at least the significant to this post part of it.

    Do that by bringing up the page in your browser and then clicking on the VIEW menu and then on the SOURCE menu item. Copy/paste from notepad's rendition of the HTML to here.

    Or, even better, show us the page live. On the 'net.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    New Coder
    Join Date
    Dec 2009
    Posts
    42
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Hi,

    This is an intranet site and I am unable to provide a link. The source code for the page in question is below - I removed the gibberish for certain values to permit posting of this response.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <!-- InstanceBegin template="/Templates/3columntem.dwt" codeOutsideHTMLIsLocked="false" -->
    <!-- DW6 -->
    <head>
    <!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    
    <!-- InstanceBeginEditable name="doctitle" -->
    
    <title>Time Management System - New Project</title>
    
    <!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
    
    
    <link href="mainstyles2.css" rel="stylesheet" type="text/css"  media="screen" />  
    <link href="print.css" rel="stylesheet" type="text/css" media="print" />
    
    <script type="text/javascript" language="javascript">    
        function changeColor(idObj,colorObj)   
        {
        document.getElementById(idObj.id).style.color = colorObj;
        } 
        function setDisplay(id,value)
        { 
        document.getElementById(id).style.display = value;
        } 
        function Empty() 
        { 
        var res=window.confirm("Please confirm cancellation-your input will be cleared"); 
        if(res==true) 
        {
        document.getElementById("chkDVTT").checked=false;
        document.getElementById("chkLM").checked=false; 
        document.getElementById("chkVMB").checked=false;
        document.getElementById("chkVEB").checked=false;
        document.getElementById("chkVUB").checked=false;    
        document.getElementById("txtDVTTRegHrs").value="0";
        document.getElementById("txtDVTTOTHrs").value="0";     
        document.getElementById("txtBRLMRegHrs").value="0";
        document.getElementById("txtBrLMOTHrs").value="0";    
        document.getElementById("txtVMBRegHrs").value="0";
        document.getElementById("txtVMBOTHrs").value="0";    
        document.getElementById("txtVEBRegHrs").value="0";
        document.getElementById("txtVEBOTHrs").value="0";         
        document.getElementById("txtVUBRegHrs").value="0";
        document.getElementById("txtVUBOTHrs").value="0";
        } 
        }  
     </script>
     
     </head>
    
    <body>
    
      <form name="form2" method="post" action="ProjectNewAsgnBrTm.aspx" id="form2">
    <div>
    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
    <input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/the gibberish was here==" />
    </div>
    
    <script type="text/javascript">
    //<![CDATA[
    var theForm = document.forms['form2'];
    if (!theForm) {
        theForm = document.form2;
    }
    function __doPostBack(eventTarget, eventArgument) {
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
            theForm.__EVENTTARGET.value = eventTarget;
            theForm.__EVENTARGUMENT.value = eventArgument;
            theForm.submit();
        }
    }
    //]]>
    </script>
    
    
    <script src="/Source/WebResource.axd?d=zhbomlNESZ991_J-J2sNyg2&amp;t=633916950834217531" type="text/javascript"></script>
    
    <div>
    
    	<input type="hidden" name="__SCROLLPOSITIONX" id="__SCROLLPOSITIONX" value="0" />
    	<input type="hidden" name="__SCROLLPOSITIONY" id="__SCROLLPOSITIONY" value="0" />
    	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/more gibberish here" />
    </div>
    
    <a name="top" id="top"></a>
    
    <!--Begin masthead div-->
    
    <div id="masthead"> <img src="images/header.jpg" alt="Header Graphic" 
    width="750" height="70" style="text-align:left;width:750;height:70;border:none;" />
    <br />
    <a href="#skiptocontent" class="skipnav">Skip to content</a> </div>
      
    <!--End mastnead div-->
    
    <!--Begin globalNav div-->
    
    <div id="globalNav"><a href="#skiptocontent" class="skipnav"></a>
    <a href="http://mwww.ba.ssa.gov">socialsecurity.gov </a> | 
    <a href="http://eis.ba.ssa.gov/">SSA Intranet</a> | <a href="index.htm">
        Web Template Home </a> | Sitemap | 
    <a href="http://eis.ba.ssa.gov/eis/dcpea/search.html">Search</a> | 
    <a href="mailto:renata.feezor@ssa.gov">Reach Us</a></div>
    
    <!--End globalNav div-->
    
    <!--Begin navBar div-->
    
    <!-- Vertical navigation bar on left side of page -->
    <span class="style1"></span>
    <div id="navBar" style="padding-left:4px">
      <p><img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp; <a href="/templates/whatsnew.htm" title="OESAE/DVTT Mission Statement"> 
          What's New </a><br />
        <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/mission.htm" title="OESAE/DVTT Mission Statement"> 
          Mission Statement</a><br />
        <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp; <a href="/templates/whoswho.htm" title="OESAE/DVTT Functional Descriptions">
          Functional Descriptions</a><br />
        <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp; <a href="/templates/dvttorg.htm" title="Organizational Chart" >
          Organization Chart</a><br />
        <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/phone.htm" title="OESAE/DVTT Phone List"> 
          Organization / Phone List</a><br />
        <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/employ.htm" title="OESAE/DVTT Employee Information"> 
          Employee Information</a><br/>
        
        <left><span class="leftnavimage"><img src="images/leftnavline.gif" width="150" height="4" border="0" alt="begin division level left navigation" leftmargin="0" /></span></left> 
       <p><img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/dvtthome.htm" title="DVTT Home">DVTT 
           Home </a><br />
        <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/ForDivisionStaff/divistaf.htm" title="For D V T T Staff">For 
           Division Staff</a><br />
        <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/DVTTApps/applications.htm" title="DVTT Applications">DVTT 
           Applications</a><br />
         </p>
            <span class="leftnavimage"><img src="images/leftnavline.gif" width="150" height="4" border="0" alt="begin division level left navigation" leftmargin="0" /></span>
        <br />
        <br />
        
        
            
        
    </div>
        
    <!--end navBar div -->      
    <!--Begin third column div-->
     
    
        
    <!--end navBar div -->      
    <!--Begin third column div-->
    
    <div id="headlines">
      
      
     </div>   
    <div id="content" 
            style="content:inherit; position:relative; top: -114px; left: 207px;"> 
    <!-- InstanceBeginEditable name="content" -->
      <h1 align="center"><a name="content2" id="content2"></a></h1>
      <div style="z-index: 102; left: 39px; position: absolute; top: -12px; width: 595px; height: 117px">
        <h1 
              style="text-align:justify; top: 30px; left: 50px; font-family: 'Tempus Sans ITC'; 
        font-size: xx-large; font-weight: bolder; color: #990033; width: 640px; height: 49px; margin-top: 19px;">
                  Time Management System - New Project
           </h1>        
        <h2 style="text-align:justify; top: -26px; position: relative; left: 109px; font-family: 'Tempus Sans ITC'; 
        font-size: x-large; font-weight: bolder; color: #990033; width: 276px; height: 33px; margin-top: 19px; text-decoration: underline;">
            Assign Branch and Team
            </h2> 
         </div>
          
        <div style="z-index: 103; left: 82px; position: absolute; top: 97px; width: 458px; height: 30px">
              <a href="tmsHome.aspx" style="color: #0000FF; font-weight: bold; text-decoration: underline; font-size: 12px;" 
                  onmouseover="this.style.color='#990033'; this.style.fontWeight='bold'; this.style.fontSize='13'" 
                  onmouseout="this.style.color='#0000FF'; this.style.fontSize='12'" 
                  tabindex="0" title="Click to return to TMS Home Page.">Home Page</a>
                          &nbsp;&nbsp;&nbsp;        
               <a id="NewProject" title="You are on the Time Management System New Project page." style="color:Black;font-size:10pt;font-weight:bold;text-decoration:underline;">New Project</a>
                          &nbsp;&nbsp;&nbsp;
                <a href="ProjectEdit.aspx" style="color: #0000FF; font-weight: bold; text-decoration: underline; font-size: 12px;" 
                  onmouseover="this.style.color='#990033'; this.style.fontWeight='bold'; this.style.fontSize='13';" 
                  onmouseout="this.style.color='#0000FF'; this.style.fontSize='12';" 
                  tabindex="1" title="Click to view/edit current projects.">View/Edit Project</a>
                          &nbsp;&nbsp;&nbsp;
               <a href="ProjectArchive.aspx" style="color: #0000FF; font-weight: bold; text-decoration: underline; font-size: 12px;" 
                  onmouseover="this.style.color='#990033'; this.style.fontWeight='bold'; this.style.fontSize='13';" 
                  onmouseout="this.style.color='#0000FF'; this.style.fontSize='12';" 
                  tabindex="4" title="Click to view all closed projects.">Archive Project</a>
                  
              <div style="border: 1px double #990033; z-index: auto; position: relative; left: -16px; width: 470px; height: 82px; top: 18px;">
                      &nbsp;&nbsp;
                      <br />
                      &nbsp;
                      <span id="Label1" style="color:#990033;">Project: </span>
                      <input name="txtBrProj" type="text" value="5032 10EP 58 JUDGE" readonly="readonly" id="txtBrProj" style="border-style:None;width:370px;" />
                      &nbsp;
                      <br />
                      <br />
                      &nbsp; <span id="Label5" style="color:#990033;">Project Hours Allocated:</span>
                      &nbsp; <span id="lblBrRegHrs">Regular</span>
                      &nbsp;&nbsp;<input name="txtBrTmRegHrs" type="text" value="225" readonly="readonly" id="txtBrTmRegHrs" style="border-style:None;width:50px;text-align:center" />
                      &nbsp;&nbsp;<span id="lblBrOTHrs">Overtime</span>
                      &nbsp;&nbsp;<input name="txtBrTmOTHrs" type="text" value="65" readonly="readonly" id="txtBrTmOTHrs" style="border-style:None;width:50px;text-align:center" />
                      &nbsp;
                      </div> 
                      <div style="z-index: auto; position: relative; top: -70px; left: 471px; width: 164px; height: 87px;">
                      
                          
                          <br />
                          <br />
                          
                      
                      </div>
     <div id="location" 
                  
                  
                  style="z-index:auto; width: 272px; height: 44px; position: relative; top: -4px; left: -56px;"> 
                &nbsp;<span id="lblAsgnBr" style="color:#990033;font-size:X-Large;font-style:italic;text-decoration:underline;">Assigned Branch:</span>
                 <br />
                 <br />
          </div>
               <div style="position:relative; top: -13px; left: -58px; height: 242px; width: 410px;">
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div id="pnlBranch" Top="0px" style="border-style:Groove;height:264px;width:384px;">
    	
                         &nbsp;
                         <span id="lblBranch" style="font-weight:bold;text-decoration:underline;">Branch</span>
                        
                         &nbsp;&nbsp;&nbsp;&nbsp;
                         <span id="lblRegHrsBr" style="display:inline-block;font-weight:bold;text-decoration:underline;width:161px;">Regular Hours Allocated</span>
                         &nbsp;&nbsp;&nbsp;
                         <span id="lblOTHrsBr" style="display:inline-block;font-weight:bold;text-decoration:underline;width:123px;">OT Hours Allocated</span>
                         &nbsp;
                         <br />
                         <br />
                         <input id="chkDVTT" type="checkbox" name="chkDVTT" checked="checked" onclick="javascript:setTimeout('__doPostBack(\'chkDVTT\',\'\')', 0)" /><label for="chkDVTT">DVTT</label>
                         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                         <input name="txtDVTTRegHrs" type="text" value="0" id="txtDVTTRegHrs" style="height:20px;width:100px;" />
                         &nbsp
                         <input name="txtBrDVTTOTHrs" type="text" value="0" id="txtBrDVTTOTHrs" style="height:20px;width:100px;" />
                         <br />
                         <br />
                         <input id="chkLM" type="checkbox" name="chkLM" onclick="javascript:setTimeout('__doPostBack(\'chkLM\',\'\')', 0)" /><label for="chkLM">LM</label>
                         &nbsp;
                         <input name="txtBRLMRegHrs" type="text" value="0" id="txtBRLMRegHrs" disabled="disabled" style="height:20px;width:100px;" />
                         &nbsp;
                         <input name="txtBrLMOTHrs" type="text" value="0" id="txtBrLMOTHrs" disabled="disabled" style="height:20px;width:100px;" />
                         <br />
                         <br />
                         <input id="chkVMB" type="checkbox" name="chkVMB" onclick="javascript:setTimeout('__doPostBack(\'chkVMB\',\'\')', 0)" /><label for="chkVMB">VMB</label>
                         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                         <input name="txtBrVMBRegHrs" type="text" value="0" id="txtBrVMBRegHrs" disabled="disabled" style="height:20px;width:100px;" />
                         &nbsp;
                         <input name="txtBrVMBOTHrs" type="text" value="0" id="txtBrVMBOTHrs" disabled="disabled" style="height:20px;width:100px;" />
                         <br />
                         <br />
                         <input id="chkVEB" type="checkbox" name="chkVEB" onclick="javascript:setTimeout('__doPostBack(\'chkVEB\',\'\')', 0)" /><label for="chkVEB">VEB</label>
                         &nbsp;
                         <input name="txtBrVEBRegHrs" type="text" value="0" id="txtBrVEBRegHrs" disabled="disabled" style="height:20px;width:100px;" />
                         &nbsp;
                         <input name="txtBrVEBOTHrs" type="text" value="0" id="txtBrVEBOTHrs" disabled="disabled" style="height:20px;width:100px;" />
                         <br />
                         <br />
                         <input id="chkVUB" type="checkbox" name="chkVUB" checked="checked" onclick="javascript:setTimeout('__doPostBack(\'chkVUB\',\'\')', 0)" /><label for="chkVUB">VUB</label>
                         &nbsp;
                         <input name="txtBrVUBRegHrs" type="text" value="0" id="txtBrVUBRegHrs" style="height:20px;width:100px;" />
                         &nbsp;
                         <input name="txtBrVUBOTHrs" type="text" value="0" id="txtBrVUBOTHrs" style="height:20px;width:100px;" />
                        
    </div>
                     &nbsp;</div>
     <div style="z-index:auto; position:relative; top: -293px; left: 357px; width: 198px; height: 43px;">
        <span id="lblAsgnTeam" style="color:#990033;font-size:X-Large;font-weight:normal;font-style:italic;text-decoration:underline;">Assigned Team:</span> 
             </div>
      <div style="z-index:auto; position: relative; top: -286px; left: 343px; width: 375px; height: 208px; margin-bottom: 0px; color: #990033;">
                  <div>
    	<table cellspacing="3" cellpadding="2" rules="all" border="4" id="grdAsgnTm" style="border-color:#CCFFFF;border-width:4px;border-style:Groove;width:353px;text-align:center">
    		<tr style="color:#CCFFFF;background-color:Black;">
    			<th scope="col">Branch</th><th scope="col">Team</th><th scope="col">Reg Hrs Allocated</th><th scope="col">OT Hrs Allocated</th>
    		</tr><tr>
    			<td>DVTT</td><td>DVTT</td><td><input name="grdAsgnTm$ctl04$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl04$ctl01" type="text" value="0" /></td>
    		</tr><tr>
    			<td>DVTT</td><td>N/A</td><td><input name="grdAsgnTm$ctl05$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl05$ctl01" type="text" value="0" /></td>
    		</tr><tr>
    			<td>VUB</td><td>DVTT</td><td><input name="grdAsgnTm$ctl22$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl22$ctl01" type="text" value="0" /></td>
    		</tr><tr>
    			<td>VUB</td><td>MIDNT</td><td><input name="grdAsgnTm$ctl23$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl23$ctl01" type="text" value="0" /></td>
    		</tr><tr>
    			<td>VUB</td><td>N/A</td><td><input name="grdAsgnTm$ctl24$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl24$ctl01" type="text" value="0" /></td>
    		</tr><tr>
    			<td>VUB</td><td>T16VDB</td><td><input name="grdAsgnTm$ctl25$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl25$ctl01" type="text" value="0" /></td>
    		</tr><tr>
    			<td>VUB</td><td>T2VDB</td><td><input name="grdAsgnTm$ctl26$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl26$ctl01" type="text" value="0" /></td>
    		</tr><tr>
    			<td>VUB</td><td>VAT</td><td><input name="grdAsgnTm$ctl27$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl27$ctl01" type="text" value="0" /></td>
    		</tr><tr>
    			<td>VUB</td><td>VTT</td><td><input name="grdAsgnTm$ctl28$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl28$ctl01" type="text" value="0" /></td>
    		</tr><tr>
    			<td>VUB</td><td>VUB</td><td><input name="grdAsgnTm$ctl29$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl29$ctl01" type="text" value="0" /></td>
    		</tr>
    	</table>
    </div> 
         <br />
         &nbsp;<input type="submit" name="btnAddBrTm" value="Submit" id="btnAddBrTm" title="Click to update or click Next to continue adding input." style="width:80px;height:30px;font-weight:bold;font-size:Small;color:#CCFFFF;border-width:4px;border-style:Ridge;border-color:#CCFFFF;background-color:Black;" />
                  &nbsp;<input type="submit" name="btnSubmitAsgnTeam" value="Next" id="btnSubmitAsgnTeam" title="Click to proceed to Team Member input." style="width:80px;height:30px;font-weight:bold;font-size:Small;color:#CCFFFF;border-width:4px;border-style:Ridge;border-color:#CCFFFF;background-color:Black;" />
                        &nbsp;
                <input type="submit" name="btnCancelAsgnTeam" value="Cancel" onclick="Empty();" id="btnCancelAsgnTeam" title="Click to cancel." style="width:80px;height:30px;font-weight:bold;font-size:Small;color:#CCFFFF;border-width:4px;border-style:Ridge;border-color:#CCFFFF;background-color:Black;" />                     
       </div>                              
       </div>
       </div>
       <br />    
       </div>  
     <script type="text/javascript">
    //<![CDATA[
    
    theForm.oldSubmit = theForm.submit;
    theForm.submit = WebForm_SaveScrollPositionSubmit;
    
    theForm.oldOnSubmit = theForm.onsubmit;
    theForm.onsubmit = WebForm_SaveScrollPositionOnSubmit;
    
    theForm.oldOnLoad = window.onload;
    window.onload = WebForm_RestoreScrollPosition;
    //]]>
    </script>
    </form>
    </body>
    </html>
    Thanks,

    John
    Last edited by Kor; 12-14-2009 at 01:17 PM. Reason: wrap the code [code][/code]

  • #7
    New Coder
    Join Date
    Dec 2009
    Posts
    42
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Please see code below - site is intranet.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <!-- InstanceBegin template="/Templates/3columntem.dwt" codeOutsideHTMLIsLocked="false" -->
    <!-- DW6 -->
    <head>
    <!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <!-- InstanceBeginEditable name="doctitle" -->

    <title>Time Management System - New Project</title>

    <!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->


    <link href="mainstyles2.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="print.css" rel="stylesheet" type="text/css" media="print" />

    <script type="text/javascript" language="javascript">
    function changeColor(idObj,colorObj)
    {
    document.getElementById(idObj.id).style.color = colorObj;
    }
    function setDisplay(id,value)
    {
    document.getElementById(id).style.display = value;
    }
    function Empty()
    {
    var res=window.confirm("Please confirm cancellation-your input will be cleared");
    if(res==true)
    {
    document.getElementById("chkDVTT").checked=false;
    document.getElementById("chkLM").checked=false;
    document.getElementById("chkVMB").checked=false;
    document.getElementById("chkVEB").checked=false;
    document.getElementById("chkVUB").checked=false;
    document.getElementById("txtDVTTRegHrs").value="0";
    document.getElementById("txtDVTTOTHrs").value="0";
    document.getElementById("txtBRLMRegHrs").value="0";
    document.getElementById("txtBrLMOTHrs").value="0";
    document.getElementById("txtVMBRegHrs").value="0";
    document.getElementById("txtVMBOTHrs").value="0";
    document.getElementById("txtVEBRegHrs").value="0";
    document.getElementById("txtVEBOTHrs").value="0";
    document.getElementById("txtVUBRegHrs").value="0";
    document.getElementById("txtVUBOTHrs").value="0";
    }
    }
    </script>

    </head>

    <body>

    <form name="form2" method="post" action="ProjectNewAsgnBrTm.aspx" id="form2">
    <div>
    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
    <input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/the gibberish was here==" />
    </div>

    <script type="text/javascript">
    //<![CDATA[
    var theForm = document.forms['form2'];
    if (!theForm) {
    theForm = document.form2;
    }
    function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    theForm.__EVENTTARGET.value = eventTarget;
    theForm.__EVENTARGUMENT.value = eventArgument;
    theForm.submit();
    }
    }
    //]]>
    </script>


    <script src="/Source/WebResource.axd?d=zhbomlNESZ991_J-J2sNyg2&amp;t=633916950834217531" type="text/javascript"></script>

    <div>

    <input type="hidden" name="__SCROLLPOSITIONX" id="__SCROLLPOSITIONX" value="0" />
    <input type="hidden" name="__SCROLLPOSITIONY" id="__SCROLLPOSITIONY" value="0" />
    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/more gibberish here" />
    </div>

    <a name="top" id="top"></a>

    <!--Begin masthead div-->

    <div id="masthead"> <img src="images/header.jpg" alt="Header Graphic"
    width="750" height="70" style="text-align:left;width:750;height:70;border:none;" />
    <br />
    <a href="#skiptocontent" class="skipnav">Skip to content</a> </div>

    <!--End mastnead div-->

    <!--Begin globalNav div-->

    <div id="globalNav"><a href="#skiptocontent" class="skipnav"></a>
    <a href="http://mwww.ba.ssa.gov">socialsecurity.gov </a> |
    <a href="http://eis.ba.ssa.gov/">SSA Intranet</a> | <a href="index.htm">
    Web Template Home </a> | Sitemap |
    <a href="http://eis.ba.ssa.gov/eis/dcpea/search.html">Search</a> |
    <a href="mailto:renata.feezor@ssa.gov">Reach Us</a></div>

    <!--End globalNav div-->

    <!--Begin navBar div-->

    <!-- Vertical navigation bar on left side of page -->
    <span class="style1"></span>
    <div id="navBar" style="padding-left:4px">
    <p><img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp; <a href="/templates/whatsnew.htm" title="OESAE/DVTT Mission Statement">
    What's New </a><br />
    <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/mission.htm" title="OESAE/DVTT Mission Statement">
    Mission Statement</a><br />
    <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp; <a href="/templates/whoswho.htm" title="OESAE/DVTT Functional Descriptions">
    Functional Descriptions</a><br />
    <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp; <a href="/templates/dvttorg.htm" title="Organizational Chart" >
    Organization Chart</a><br />
    <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/phone.htm" title="OESAE/DVTT Phone List">
    Organization / Phone List</a><br />
    <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/employ.htm" title="OESAE/DVTT Employee Information">
    Employee Information</a><br/>

    <left><span class="leftnavimage"><img src="images/leftnavline.gif" width="150" height="4" border="0" alt="begin division level left navigation" leftmargin="0" /></span></left>
    <p><img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/dvtthome.htm" title="DVTT Home">DVTT
    Home </a><br />
    <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/ForDivisionStaff/divistaf.htm" title="For D V T T Staff">For
    Division Staff</a><br />
    <img src="images/redarrow.gif" alt="red arrow" width="10" height="9" />&nbsp;<a href="/templates/DVTTApps/applications.htm" title="DVTT Applications">DVTT
    Applications</a><br />
    </p>
    <span class="leftnavimage"><img src="images/leftnavline.gif" width="150" height="4" border="0" alt="begin division level left navigation" leftmargin="0" /></span>
    <br />
    <br />




    </div>

    <!--end navBar div -->
    <!--Begin third column div-->



    <!--end navBar div -->
    <!--Begin third column div-->

    <div id="headlines">


    </div>
    <div id="content"
    style="content:inherit; position:relative; top: -114px; left: 207px;">
    <!-- InstanceBeginEditable name="content" -->
    <h1 align="center"><a name="content2" id="content2"></a></h1>
    <div style="z-index: 102; left: 39px; position: absolute; top: -12px; width: 595px; height: 117px">
    <h1
    style="text-align:justify; top: 30px; left: 50px; font-family: 'Tempus Sans ITC';
    font-size: xx-large; font-weight: bolder; color: #990033; width: 640px; height: 49px; margin-top: 19px;">
    Time Management System - New Project
    </h1>
    <h2 style="text-align:justify; top: -26px; position: relative; left: 109px; font-family: 'Tempus Sans ITC';
    font-size: x-large; font-weight: bolder; color: #990033; width: 276px; height: 33px; margin-top: 19px; text-decoration: underline;">
    Assign Branch and Team
    </h2>
    </div>

    <div style="z-index: 103; left: 82px; position: absolute; top: 97px; width: 458px; height: 30px">
    <a href="tmsHome.aspx" style="color: #0000FF; font-weight: bold; text-decoration: underline; font-size: 12px;"
    onmouseover="this.style.color='#990033'; this.style.fontWeight='bold'; this.style.fontSize='13'"
    onmouseout="this.style.color='#0000FF'; this.style.fontSize='12'"
    tabindex="0" title="Click to return to TMS Home Page.">Home Page</a>
    &nbsp;&nbsp;&nbsp;
    <a id="NewProject" title="You are on the Time Management System New Project page." style="color:Black;font-size:10pt;font-weight:bold;text-decoration:underline;">New Project</a>
    &nbsp;&nbsp;&nbsp;
    <a href="ProjectEdit.aspx" style="color: #0000FF; font-weight: bold; text-decoration: underline; font-size: 12px;"
    onmouseover="this.style.color='#990033'; this.style.fontWeight='bold'; this.style.fontSize='13';"
    onmouseout="this.style.color='#0000FF'; this.style.fontSize='12';"
    tabindex="1" title="Click to view/edit current projects.">View/Edit Project</a>
    &nbsp;&nbsp;&nbsp;
    <a href="ProjectArchive.aspx" style="color: #0000FF; font-weight: bold; text-decoration: underline; font-size: 12px;"
    onmouseover="this.style.color='#990033'; this.style.fontWeight='bold'; this.style.fontSize='13';"
    onmouseout="this.style.color='#0000FF'; this.style.fontSize='12';"
    tabindex="4" title="Click to view all closed projects.">Archive Project</a>

    <div style="border: 1px double #990033; z-index: auto; position: relative; left: -16px; width: 470px; height: 82px; top: 18px;">
    &nbsp;&nbsp;
    <br />
    &nbsp;
    <span id="Label1" style="color:#990033;">Project: </span>
    <input name="txtBrProj" type="text" value="5032 10EP 58 JUDGE" readonly="readonly" id="txtBrProj" style="border-style:None;width:370px;" />
    &nbsp;
    <br />
    <br />
    &nbsp; <span id="Label5" style="color:#990033;">Project Hours Allocated:</span>
    &nbsp; <span id="lblBrRegHrs">Regular</span>
    &nbsp;&nbsp;<input name="txtBrTmRegHrs" type="text" value="225" readonly="readonly" id="txtBrTmRegHrs" style="border-style:None;width:50px;text-align:center" />
    &nbsp;&nbsp;<span id="lblBrOTHrs">Overtime</span>
    &nbsp;&nbsp;<input name="txtBrTmOTHrs" type="text" value="65" readonly="readonly" id="txtBrTmOTHrs" style="border-style:None;width:50px;text-align:center" />
    &nbsp;
    </div>
    <div style="z-index: auto; position: relative; top: -70px; left: 471px; width: 164px; height: 87px;">


    <br />
    <br />


    </div>
    <div id="location"


    style="z-index:auto; width: 272px; height: 44px; position: relative; top: -4px; left: -56px;">
    &nbsp;<span id="lblAsgnBr" style="color:#990033;font-size:X-Large;font-style:italic;text-decoration:underline;">Assigned Branch:</span>
    <br />
    <br />
    </div>
    <div style="position:relative; top: -13px; left: -58px; height: 242px; width: 410px;">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div id="pnlBranch" Top="0px" style="border-style:Groove;height:264px;width:384px;">

    &nbsp;
    <span id="lblBranch" style="font-weight:bold;text-decoration:underline;">Branch</span>

    &nbsp;&nbsp;&nbsp;&nbsp;
    <span id="lblRegHrsBr" style="display:inline-block;font-weight:bold;text-decoration:underline;width:161px;">Regular Hours Allocated</span>
    &nbsp;&nbsp;&nbsp;
    <span id="lblOTHrsBr" style="display:inline-block;font-weight:bold;text-decoration:underline;width:123px;">OT Hours Allocated</span>
    &nbsp;
    <br />
    <br />
    <input id="chkDVTT" type="checkbox" name="chkDVTT" checked="checked" onclick="javascript:setTimeout('__doPostBack(\'chkDVTT\',\'\')', 0)" /><label for="chkDVTT">DVTT</label>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input name="txtDVTTRegHrs" type="text" value="0" id="txtDVTTRegHrs" style="height:20px;width:100px;" />
    &nbsp
    <input name="txtBrDVTTOTHrs" type="text" value="0" id="txtBrDVTTOTHrs" style="height:20px;width:100px;" />
    <br />
    <br />
    <input id="chkLM" type="checkbox" name="chkLM" onclick="javascript:setTimeout('__doPostBack(\'chkLM\',\'\')', 0)" /><label for="chkLM">LM</label>
    &nbsp;
    <input name="txtBRLMRegHrs" type="text" value="0" id="txtBRLMRegHrs" disabled="disabled" style="height:20px;width:100px;" />
    &nbsp;
    <input name="txtBrLMOTHrs" type="text" value="0" id="txtBrLMOTHrs" disabled="disabled" style="height:20px;width:100px;" />
    <br />
    <br />
    <input id="chkVMB" type="checkbox" name="chkVMB" onclick="javascript:setTimeout('__doPostBack(\'chkVMB\',\'\')', 0)" /><label for="chkVMB">VMB</label>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input name="txtBrVMBRegHrs" type="text" value="0" id="txtBrVMBRegHrs" disabled="disabled" style="height:20px;width:100px;" />
    &nbsp;
    <input name="txtBrVMBOTHrs" type="text" value="0" id="txtBrVMBOTHrs" disabled="disabled" style="height:20px;width:100px;" />
    <br />
    <br />
    <input id="chkVEB" type="checkbox" name="chkVEB" onclick="javascript:setTimeout('__doPostBack(\'chkVEB\',\'\')', 0)" /><label for="chkVEB">VEB</label>
    &nbsp;
    <input name="txtBrVEBRegHrs" type="text" value="0" id="txtBrVEBRegHrs" disabled="disabled" style="height:20px;width:100px;" />
    &nbsp;
    <input name="txtBrVEBOTHrs" type="text" value="0" id="txtBrVEBOTHrs" disabled="disabled" style="height:20px;width:100px;" />
    <br />
    <br />
    <input id="chkVUB" type="checkbox" name="chkVUB" checked="checked" onclick="javascript:setTimeout('__doPostBack(\'chkVUB\',\'\')', 0)" /><label for="chkVUB">VUB</label>
    &nbsp;
    <input name="txtBrVUBRegHrs" type="text" value="0" id="txtBrVUBRegHrs" style="height:20px;width:100px;" />
    &nbsp;
    <input name="txtBrVUBOTHrs" type="text" value="0" id="txtBrVUBOTHrs" style="height:20px;width:100px;" />

    </div>
    &nbsp;</div>
    <div style="z-index:auto; position:relative; top: -293px; left: 357px; width: 198px; height: 43px;">
    <span id="lblAsgnTeam" style="color:#990033;font-size:X-Large;font-weight:normal;font-style:italic;text-decoration:underline;">Assigned Team:</span>
    </div>
    <div style="z-index:auto; position: relative; top: -286px; left: 343px; width: 375px; height: 208px; margin-bottom: 0px; color: #990033;">
    <div>
    <table cellspacing="3" cellpadding="2" rules="all" border="4" id="grdAsgnTm" style="border-color:#CCFFFF;border-width:4px;border-style:Groove;width:353px;text-align:center">
    <tr style="color:#CCFFFF;background-color:Black;">
    <th scope="col">Branch</th><th scope="col">Team</th><th scope="col">Reg Hrs Allocated</th><th scope="col">OT Hrs Allocated</th>
    </tr><tr>
    <td>DVTT</td><td>DVTT</td><td><input name="grdAsgnTm$ctl04$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl04$ctl01" type="text" value="0" /></td>
    </tr><tr>
    <td>DVTT</td><td>N/A</td><td><input name="grdAsgnTm$ctl05$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl05$ctl01" type="text" value="0" /></td>
    </tr><tr>
    <td>VUB</td><td>DVTT</td><td><input name="grdAsgnTm$ctl22$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl22$ctl01" type="text" value="0" /></td>
    </tr><tr>
    <td>VUB</td><td>MIDNT</td><td><input name="grdAsgnTm$ctl23$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl23$ctl01" type="text" value="0" /></td>
    </tr><tr>
    <td>VUB</td><td>N/A</td><td><input name="grdAsgnTm$ctl24$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl24$ctl01" type="text" value="0" /></td>
    </tr><tr>
    <td>VUB</td><td>T16VDB</td><td><input name="grdAsgnTm$ctl25$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl25$ctl01" type="text" value="0" /></td>
    </tr><tr>
    <td>VUB</td><td>T2VDB</td><td><input name="grdAsgnTm$ctl26$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl26$ctl01" type="text" value="0" /></td>
    </tr><tr>
    <td>VUB</td><td>VAT</td><td><input name="grdAsgnTm$ctl27$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl27$ctl01" type="text" value="0" /></td>
    </tr><tr>
    <td>VUB</td><td>VTT</td><td><input name="grdAsgnTm$ctl28$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl28$ctl01" type="text" value="0" /></td>
    </tr><tr>
    <td>VUB</td><td>VUB</td><td><input name="grdAsgnTm$ctl29$ctl00" type="text" value="0" /></td><td><input name="grdAsgnTm$ctl29$ctl01" type="text" value="0" /></td>
    </tr>
    </table>
    </div>
    <br />
    &nbsp;<input type="submit" name="btnAddBrTm" value="Submit" id="btnAddBrTm" title="Click to update or click Next to continue adding input." style="width:80px;height:30px;font-weight:bold;font-size:Small;color:#CCFFFF;border-width:4px;border-style:Ridge;border-color:#CCFFFF;background-color:Black;" />
    &nbsp;<input type="submit" name="btnSubmitAsgnTeam" value="Next" id="btnSubmitAsgnTeam" title="Click to proceed to Team Member input." style="width:80px;height:30px;font-weight:bold;font-size:Small;color:#CCFFFF;border-width:4px;border-style:Ridge;border-color:#CCFFFF;background-color:Black;" />
    &nbsp;
    <input type="submit" name="btnCancelAsgnTeam" value="Cancel" onclick="Empty();" id="btnCancelAsgnTeam" title="Click to cancel." style="width:80px;height:30px;font-weight:bold;font-size:Small;color:#CCFFFF;border-width:4px;border-style:Ridge;border-color:#CCFFFF;background-color:Black;" />
    </div>
    </div>
    </div>
    <br />
    </div>
    <script type="text/javascript">
    //<![CDATA[

    theForm.oldSubmit = theForm.submit;
    theForm.submit = WebForm_SaveScrollPositionSubmit;

    theForm.oldOnSubmit = theForm.onsubmit;
    theForm.onsubmit = WebForm_SaveScrollPositionOnSubmit;

    theForm.oldOnLoad = window.onload;
    window.onload = WebForm_RestoreScrollPosition;
    //]]>
    </script>
    </form>
    </body>
    </html>

    Thanks,

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,966
    Thanks
    79
    Thanked 4,429 Times in 4,394 Posts
    Well, that was dead easy.

    You know, if you would TURN ON JavaScript debugging, even MSIE would tell you about simple problems like this:

    document.getElementById("txtDVTTOTHrs").value="0";

    There's no such ID as that, so of course it gets and error and stops right there.

    *DO* turn on JS debugging! And if you don't have any other JS debugger, you can download either the MS Script Debugger or maybe the Express (free) edition of Visual Web Developer.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    JohnShell (12-16-2009)

  • #9
    New Coder
    Join Date
    Dec 2009
    Posts
    42
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Thanks - saw the error late yesterday and made the necessary corrections. Will have to secure MS Script Debugger since the js errors are not appearing on my forms.
    Again - many thanks - everyone.

  • #10
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,966
    Thanks
    79
    Thanked 4,429 Times in 4,394 Posts
    Even without the debugger, if you turn on JS errors you will at least get an error message about the error.

    With MSIE do this:
    -- Click on TOOLS menu
    -- Click on INTERNET OPTIONS menu item
    -- Click on ADVANCED tab
    -- *UN*check "disable script debugging (Internet Explorer)
    -- *CHECK* "display a notification about every script error"

    The latter will annoy the heck out of you, as you will find that at least 25% of the sites you visit with IE have script errors. So you probably only want to have that checked when you are debugging your own pages.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •