Focus after page refresh

Set Focus after page submits (refreshes)

I have two list menus&.category and subcategory.

Once the user selects a Category the Subcategory menu is popluated from a database.  Since the page submits to itself on the refresh the form/page scrolls to the top and I want the Focus to be on the next selection menu Subcategory which is at the bottom of the page.


ASP page:

      <SELECT NAME="Category" onChange="SubmitCategory()" class="copy">
      <%Call FillCategory%>
      </SELECT>


JS page:

function SubmitCategory()

      {
          var objForm = document.forms[0];
       objForm.elements['SubCategory'].selectedIndex = 0;             
          objForm.submit();       
      }
pgoosemanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PhatzerCommented:
Give the selectbox you wish to focus an ID, then put the ID in the middle of the ('') in the code below... So:

... id="cake">

getElementById('cake')
JUST ABOVE </body>:
 
<script language="javascript" type="text/javascript">
<!--
 
document.getElementById('').focus();
 
//-->
</script>

Open in new window

0
BenMorelCommented:
Hi,
To scroll the page up to an object, use the scrollIntoView() method.

For example to automatically scroll to your form on load :
<body onload="var f = document.forms[0]; if (f.scrollIntoView) f.scrollIntoView();">

For a smarter solution, you should maybe consider using AJAX to do that without refreshing the page ;)

Regards,
Ben
0
ZvonkoSystems architectCommented:
From the submitting page you cannot control what will be focused in the Response page from browser side because at submit you loose control of following pages.
But the server side does react to the submit Request with a page Response that can contain script for focus, select and scrollIntoView().

Like this:

<select name="subcategory">
</select>
<script>
document.forms[0].subcategory.scrollIntoView();
document.forms[0].subcategory.focus();
</script>

Open in new window

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

pgoosemanAuthor Commented:
I inserted this after the <select> and it did not work.
 
<script>
document.forms[0].subcategory.scrollIntoView();
document.forms[0].subcategory.focus();
</script>
0
BenMorelCommented:
Maybe with the good case ?
<script>
document.forms[0].SubCategory.scrollIntoView();
</script>
0
pgoosemanAuthor Commented:
Still not scrolling down.

                    <TR>
      <TD>Subcategory</TD>
      <TD>
      <SELECT NAME="SubCategory" onChange="SubmitSubCategory()" class="copy">
      <%Call FillSubCategory%>
      </SELECT>
      
      <script>
      document.forms[0].SubCategory.scrollIntoView();
      document.forms[0].SubCategory.focus();
      </script>

JS page:

function SubmitCategory()

      {
          var objForm = document.forms[0];
       objForm.elements['SubCategory'].selectedIndex = 0;              
          objForm.submit();        
      }

0
BenMorelCommented:
The problem is that we don't have your full html code (the one generated by asp), so it's quite difficult to help you :)
0
pgoosemanAuthor Commented:
Here is the full ASP page with the scrollintoview and focus added in as mentioed above.

 
 
 
      <%
 
      DIM RS
      DIM vSQL            
      DIM vCAPT
      DIM vOffice
      DIM vDepartments
      DIM vCategory
      DIM vSubCategory
      DIM vProblem
      DIM vMailSpecialist
      DIM vSpecialistAlias
      DIM strDateReceived
      DIM strTimeReceived       
      DIM strCallerAlias
      DIM strCallerName
      DIM strCAPT
      DIM strOffice
      DIM strDepartments
      DIM strNetOp
      DIM strCallAppr
        DIM strCategory
      DIM strSubCategory
      DIM strProblem
      DIM strProblemDesc
      DIM strNotes
      DIM strSelected
      DIM strMailSpecialist
      DIM strSpecialistAlias
      DIM strSpecialistComments
      

      strDateReceived            = REQUEST.FORM("DateReceived")
      strTimeReceived       = REQUEST.FORM("TimeReceived")
      strCallerAlias      = REQUEST.FORM("CallerAlias")
      strCallerName      = REQUEST.FORM("CallerName")
      strCAPT             = REQUEST.FORM("CAPT")
      strDepartments      = REQUEST.FORM("Department")
      strOffice            = REQUEST.FORM("Office")
      strNetOp            = REQUEST.FORM("NetOp")
      strCallAppr            = REQUEST.FORM("CallAppr")
        strCategory             = REQUEST.FORM("Category")
      strSubCategory        = REQUEST.FORM("SubCategory")
      strProblem             = REQUEST.FORM("Problem")
      strProblemDesc      = REQUEST.FORM("ProblemDesc")
      strNotes            = REQUEST.FORM("Notes")
      strMailSpecialist      = REQUEST.FORM("Status")
      strSpecialistAlias      = REQUEST.FORM("Specialist")
      strSpecialistComments      = REQUEST.FORM("SpecialistComments")
 
      
      '---------------------------------------------------------

      Sub FillDateReceived()      

      IF strDateReceived <> ""  THEN
      RESPONSE.WRITE strDateReceived
      END IF
      
      END sub

      
      '---------------------------------------------------------

      Sub FillTimeReceived()

      IF strTimeReceived <> "" THEN
      RESPONSE.WRITE strTimeReceived
      END IF
      
      END SUB



      '---------------------------------------------------------

      Sub FillCAPT()
      
      Set RS = Server.CreateObject("ADODB.Recordset")      
      vSQL = "" 
      vSQL = vSQL & "SELECT CAPTName FROM tblCAPT"
      vSQL = vSQL & " ORDER BY CAPTName  asc"
      Set RS = cn.Execute(vSQL)
      
      RESPONSE.WRITE ("<OPTION>>> Select >></OPTION>" & VBCRLF)       

      DO WHILE NOT RS.EOF             

      vCAPT= RS("CAPTName")

      IF vCAPT  = strCAPT THEN
      strSelected = " Selected "
      ELSE
      strSelected = ""      
      END IF

      RESPONSE.WRITE "<option value='"
      RESPONSE.WRITE vCAPT
      RESPONSE.WRITE "' "
      RESPONSE.WRITE strSelected
 
      RESPONSE.WRITE "  >"
      RESPONSE.WRITE  vCAPT       
      RESPONSE.WRITE "</option>"
      
       RS.MoveNext
        Loop
        RS.Close
        SET RS = Nothing
 
      END SUB
      
      '---------------------------------------------------------

      
      Sub FillCallerAlias()

      IF strCallerAlias <> "" THEN
      RESPONSE.WRITE strCallerAlias
      END IF
      
      END SUB

      '---------------------------------------------------------


      
      Sub FillCallerName()

      IF strCallerName <> "" THEN
      RESPONSE.WRITE strCallerName
      END IF
      
      END SUB

      '---------------------------------------------------------


      Sub FillDept()
      Set RS = Server.CreateObject("ADODB.Recordset")      
      vSQL = "" 
      vSQL = vSQL & "SELECT Departments FROM tblDepartments"
      vSQL = vSQL & " ORDER BY Departments asc"
      Set RS = cn.Execute(vSQL)  
      
      RESPONSE.WRITE ("<OPTION>>> Select >></OPTION>" & VBCRLF)       

      DO WHILE NOT RS.EOF             

      vDepartments= RS("Departments")

      IF vDepartments  = strDepartments THEN
      strSelected = " Selected "
      ELSE
      strSelected = ""      
      END IF

      RESPONSE.WRITE "<option value='"
      RESPONSE.WRITE vDepartments
      RESPONSE.WRITE "' "
      RESPONSE.WRITE strSelected
 
      RESPONSE.WRITE "  >"
      RESPONSE.WRITE  vDepartments      
      RESPONSE.WRITE "</option>"
      
       RS.MoveNext
        Loop
        RS.Close
        SET RS = Nothing
      
      END SUB

      '---------------------------------------------------------
      
      Sub FillOffice()
      Set RS = Server.CreateObject("ADODB.Recordset")      
      vSQL = "" 
      vSQL = vSQL & "SELECT Office FROM tblOffice"
      vSQL = vSQL & " ORDER BY Office asc"
      Set RS = cn.Execute(vSQL)
      
      RESPONSE.WRITE ("<OPTION>>> Select >></OPTION>" & VBCRLF)       

      DO WHILE NOT RS.EOF             

      vOffice= RS("Office")

      IF vOffice  = strOffice THEN
      strSelected = " Selected "
      ELSE
      strSelected = ""      
      END IF

      RESPONSE.WRITE "<option value='"
      RESPONSE.WRITE vOffice
      RESPONSE.WRITE "' "
      RESPONSE.WRITE strSelected
 
      RESPONSE.WRITE "  >"
      RESPONSE.WRITE  vOffice      
      RESPONSE.WRITE "</option>"
      
       RS.MoveNext
        Loop
        RS.Close
        SET RS = Nothing
      
      END SUB

      '---------------------------------------------------------
      
      Sub FillCallAppr()
      
      
      RESPONSE.WRITE ("<OPTION>>> Select >></OPTION>" & VBCRLF)            

      RESPONSE.WRITE "<option value='Yes' " 
      IF strCallAppr = "Yes" THEN             
      RESPONSE.WRITE "SELECTED >Yes</option>"
      ELSE
      RESPONSE.WRITE ">Yes</option>"
      END IF
      
      RESPONSE.WRITE "<option value='No' " 
      IF strCallAppr = "No" THEN       
      RESPONSE.WRITE "SELECTED >No</option>"
      ELSE
      RESPONSE.WRITE ">No</option>"
      END IF  
      
      END SUB

      '---------------------------------------------------------

      Sub FillNetOp()
      
      RESPONSE.WRITE ("<OPTION>>> Select >></OPTION>" & VBCRLF)            

      RESPONSE.WRITE "<option value='Yes' " 
      IF strNetOp = "Yes" THEN       
      RESPONSE.WRITE "SELECTED >Yes</option>"
      ELSE
      RESPONSE.WRITE ">Yes</option>"
      END IF
      
      RESPONSE.WRITE "<option value='No' " 
      IF strNetOp = "No" THEN       
      RESPONSE.WRITE "SELECTED >No</option>"
      ELSE
      RESPONSE.WRITE ">No</option>"
      END IF  
      
      END SUB

      '---------------------------------------------------------
      
      Sub FillCategory()
      Set RS = Server.CreateObject("ADODB.Recordset")
      vSQL = ""
      vSQL = vSQL & "SELECT DISTINCT(Category) FROM tblCategory "
      vSQL = vSQL & " ORDER BY Category "
      Set RS = cn.Execute(vSQL)
      
      
      RESPONSE.WRITE ("<OPTION>>> Select a category >></OPTION>" & VBCRLF)       

      DO WHILE NOT RS.EOF             

      vCategory = RS("Category")

      IF vCategory  = strCategory THEN
      strSelected = " Selected "
      ELSE
      strSelected = ""      
      END IF

      RESPONSE.WRITE "<option value='"
      RESPONSE.WRITE vCategory
      RESPONSE.WRITE "' "
      RESPONSE.WRITE strSelected
 
      RESPONSE.WRITE "  >"
      RESPONSE.WRITE  vCategory        
      RESPONSE.WRITE "</option>"
      
       RS.MoveNext
        Loop
        RS.Close
        SET RS = Nothing
      
      END SUB
      

      '---------------------------------------------------------
      
      Sub FillSubCategory()
      
      IF strCategory <> "" THEN

      Set RS = Server.CreateObject("ADODB.Recordset")
      vSQL = ""
      vSQL = vSQL & "SELECT DISTINCT(SubCategory) FROM tblCategory "
      vSQL = vSQL & "WHERE Category = '" & strCategory & "' "
      vSQL = vSQL & " ORDER BY SubCategory "
      Set RS = cn.Execute(vSQL)

      RESPONSE.WRITE ("<OPTION>>> Select a subcategory >></OPTION>" & VBCRLF)

      DO WHILE NOT RS.EOF             

      vSubCategory = RS("SubCategory")

       IF vSubCategory  = strSubCategory THEN
       strSelected = " Selected "
       ELSE
       strSelected = ""      
       END IF

      RESPONSE.WRITE "<option value='"
      RESPONSE.WRITE vSubCategory
      RESPONSE.WRITE "' "
      RESPONSE.WRITE strSelected
 
      RESPONSE.WRITE "  >"
      RESPONSE.WRITE  vSubCategory        
      RESPONSE.WRITE "</option>"
      
       RS.MoveNext
        Loop
        RS.Close
        SET RS = Nothing
      
      ELSE
      RESPONSE.WRITE "(<OPTION>>> Select a subcategory >></OPTION>)"

      END IF

      END SUB

      '---------------------------------------------------------

      Sub FillProblem()
      
      IF strSubCategory <> "" THEN

      Set RS = Server.CreateObject("ADODB.Recordset")
      vSQL = ""
      vSQL = vSQL & "SELECT DISTINCT(Problem) FROM tblCategory "
      vSQL = vSQL & "WHERE SubCategory = '" & strSubCategory & "' "
      vSQL = vSQL & " ORDER BY Problem "
      Set RS = cn.Execute(vSQL)

      RESPONSE.WRITE ("<OPTION>>> Select a problem >></OPTION>" & VBCRLF)

      DO WHILE NOT RS.EOF             

      vProblem = RS("Problem")

       IF  vProblem = strProblem THEN
       strSelected = " Selected "
       ELSE
       strSelected = ""      
       END IF

       RESPONSE.WRITE "<option value='"
      RESPONSE.WRITE vProblem
      RESPONSE.WRITE "' "
      RESPONSE.WRITE strSelected
 
      RESPONSE.WRITE "  >"
      RESPONSE.WRITE  vProblem       
      RESPONSE.WRITE "</option>"
      
       RS.MoveNext
        Loop
        RS.Close
        SET RS = Nothing
      
      ELSE
      RESPONSE.WRITE "(<OPTION>>> Select a problem >></OPTION>)"

      END IF
      END SUB

      '---------------------------------------------------------


      Sub FillProblemDesc()

      IF strProblemDesc <> "" THEN
      RESPONSE.WRITE strProblemDesc
      END IF
      
      END SUB

      '---------------------------------------------------------
      
      Sub FillNotes()

      IF strNotes <> "" THEN
      RESPONSE.WRITE strNotes
      END IF
      
      END SUB


      '---------------------------------------------------------



      Sub FillMailSpecialist()
      
      RESPONSE.WRITE ("<OPTION>>> Select >></OPTION>" & VBCRLF)            

      RESPONSE.WRITE "<option value='Closed' " 
      IF strMailSpecialist = "Closed" THEN       
      RESPONSE.WRITE "SELECTED >Yes</option>"
      ELSE
      RESPONSE.WRITE ">Yes</option>"
      END IF
      
      RESPONSE.WRITE "<option value='Open' " 
      IF strMailSpecialist = "Open" THEN       
      RESPONSE.WRITE "SELECTED >No</option>"
      ELSE
      RESPONSE.WRITE ">No</option>"
      END IF  
      
      END SUB


      '---------------------------------------------------------

      Sub FillSpecialist()

      DIM vSpecialistName
      DIM vSpecialistAlias
      
      IF strMailSpecialist <> "" AND strMailSpecialist = "Closed" THEN

      Set RS = Server.CreateObject("ADODB.Recordset")
      vSQL = ""
      vSQL = vSQL & "SELECT * FROM tblSpecialist "      
      vSQL = vSQL & " ORDER BY SpecialistName "
      Set RS = cn.Execute(vSQL)

      RESPONSE.WRITE ("<OPTION>>> Select a specialist >></OPTION>" & VBCRLF)

      DO WHILE NOT RS.EOF             

      vSpecialistName  = RS("SpecialistName")
      vSpecialistAlias = RS("SpecialistAlias")

      IF  vSpecialistAlias = strSpecialistAlias THEN
      strSelected = " Selected "
      ELSE
      strSelected = ""      
      END IF

       RESPONSE.WRITE "<option value='"
      RESPONSE.WRITE vSpecialistAlias
      RESPONSE.WRITE "' "
      RESPONSE.WRITE strSelected
 
      RESPONSE.WRITE "  >"
      RESPONSE.WRITE  vSpecialistName      
      RESPONSE.WRITE "</option>"       
      
       RS.MoveNext
        Loop
        RS.Close
        SET RS = Nothing
      
      ELSE
      'RESPONSE.WRITE "(<OPTION value='NA'> Send Later</OPTION>)"
      

      END IF
      END SUB


      '---------------------------------------------------------

      
      Sub FillSpecialistComments()

      IF strSpecialistComments <> "" THEN
      RESPONSE.WRITE strSpecialistComments
      END IF
      
      END SUB
      %>
      
      <BODY>
      <TABLE border="0" cellspacing="3" cellpadding="3" class="copy" width="100%">
      <FORM ACTION="" METHOD="POST" NAME="HD" onSubmit="return SubmitForm()">
      
      <TR>
      <TD valign="top">&nbsp;</TD>
      <TD valign="top">&nbsp;</TD>
      </TR>

      <TR>
      <TD  valign="top">Date Received </TD>
      <TD valign="top">
      <INPUT TYPE="text" NAME="DateReceived" VALUE="<%Call FillDateReceived%>" SIZE=10>

      <A HREF="#"  onClick="enterToday(this,HD.DateReceived)"  ID="DateReceived">

      <img src="images/calendaricon.gif" border="0" class="DatePicker" alt="click here to insert current date"/></A>
      </TD>
      </TR>
      
 


      <TR>
      <TD valign="top">Time Received </TD>
      <TD valign="top">
      <input name="TimeReceived" type="text" size="10"   value="<%Call FillTimeReceived%>" >        
      
      <A HREF="#"  onClick="enterTime(this,HD.TimeReceived)"  ID="TimeReceived">

      <img src="images/clock.jpg" border="0" class="DatePicker" alt="click here to insert current time"/></A>

 
 
      
      </TD>
      </TR>
      
      <TR>
      <TD>CAPT</TD>
      <TD>
      <SELECT NAME="CAPT" class="copy">
      <%Call FillCAPT%>
      </SELECT>
      </TD></TR>


      <TR>
      <TD valign="top">Caller Alias </TD>
      <TD valign="top"><input name="CallerAlias" type="text" size="4" maxlength="4" value="<%Call FillCallerAlias%>">
      
      </TD>
      </TR>

      <TR>
      <TD valign="top">Caller Name </TD>
      <TD valign="top"><input name="CallerName" type="text" size="30" value="<%Call FillCallerName%>"></TD>
      </TR>      

      <TR>
      <TD>Office</TD>
      <TD>
      <SELECT NAME="Office" class="copy">
      <%Call FillOffice%>
      </SELECT>
      </TD></TR>

      <TR>
      <TD>Department</TD>
      <TD>
      <SELECT NAME="Department" class="copy">
      <%Call FillDept%>
      </SELECT>
      </TD></TR>
      
      <TR>
      <TD colspan="2" valign="top"><HR size=2 noshade color=#ecece4> </TD>
      </TR>

      
<%'--------------------------------------------------------%>

      <TR>
      <TD>Call Appropriate</TD>
      <TD>
      <SELECT NAME="CallAppr" class="copy">
      
      <%Call FillCallAppr%>
      </SELECT>
      </TD></TR>

      <TR>
      <TD>NetOp</TD>
      <TD>
      
      <SELECT NAME="NetOp" class="copy">
      
      <%Call FillNetOp%>
      </SELECT>
      </TD></TR>



        
      <TR>
      <TD>Category</TD>
      <TD>
      <SELECT NAME="Category" onChange="SubmitCategory()" class="copy">
      <%Call FillCategory%>
      </SELECT>
      </TD></TR>
      
      <TR>
      <TD>Subcategory</TD>
      <TD>
      <SELECT NAME="SubCategory" onChange="SubmitSubCategory()" class="copy">
      <%Call FillSubCategory%>
      </SELECT>
      
      <script>
      document.forms[0].SubCategory.scrollIntoView();
      document.forms[0].SubCategory.focus();
      </script>
        
      </TD></TR>
        
      <TR>
      <TD>Problem</TD>
      <TD>
      <SELECT NAME="Problem" class="copy">
      <%Call FillProblem%>
      </SELECT>
      </TD></TR>       
      
      <TR>
      <TD valign="top">Additional problem description </TD>
      <TD valign="top">
        <textarea name="ProblemDesc" cols="40" rows="5"><%Call FillProblemDesc%></textarea>
      </TD>
      </TR>
      
      <TR>
      <TD valign="top">Resoultion / Notes</TD>
      <TD valign="top">
        <textarea name="Notes" cols="40" rows="5"><%Call FillNotes%></textarea>
      </TD>
      </TR>

      <TR>
      <TD valign="top">Send To Specialist</TD>
      <TD valign="top">  
      <SELECT NAME="Status" onChange="SubmitSpecialist()" class="copy">
      
      <%Call FillMailSpecialist%>
      </SELECT>
      

      
      </TD>
      </TR>

      <TR>
      <TD valign="top">Specialist</TD>
      <TD valign="top">         
       <SELECT NAME="Specialist" class="copy" ID="Specialist">

      <%
      


       IF strMailSpecialist  = "Open" THEN
       RESPONSE.WRITE "<OPTION VALUE='NA' CLASS='COPY'>Send later</OPTION>"
       ELSE

       Call FillSpecialist

       END IF


      %>
      </SELECT>
 

 

      <BR>
      <%
      RESPONSE.WRITE "<INPUT TYPE='HIDDEN' NAME='MAILSPEC' SIZE='6' VALUE='"
      RESPONSE.WRITE strMailSpecialist
      RESPONSE.WRITE "'>"
      %>      
 
      </TD>
      </TR>

      <TR>
      <TD valign="top">Specialist Notes</TD>
      <TD valign="top">
        <textarea name="SpecialistComments" cols="40" rows="5"><%Call FillSpecialistComments%></textarea>
      </TD>
      </TR>


      <TR>
      <TD>&nbsp;</TD>
      <TD><INPUT TYPE="submit"  VALUE="Submit" CLASS="copy" onClick="return CheckTracker(this.form)" >&nbsp;
      <BUTTON CLASS="copy" onclick="window.location.href='index.asp';">Reset</BUTTON>
      </TD></TR>
      
 
      </FORM>
      </TABLE>
      </BODY>
 


 
 
0
BenMorelCommented:
Hi, could you rather give us the generated code ("show source" in your browser) ?
Thanks.
0
pgoosemanAuthor Commented:
<head>

<SCRIPT LANGUAGE="JavaScript" SRC="scripts/MenuChange.js" type="text/JavaScript"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/DeleteConfirm.js" type="text/JavaScript"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/JumpMenu.js" type="text/JavaScript"></SCRIPT>  
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/Verify.js" type="text/JavaScript"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/DateTime.js" type="text/JavaScript"></SCRIPT>       
 
</head>

<body bgcolor="#36578c" TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0 >
<table width="773" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td colspan="4" valign="top">
<table width="773" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><a href="index.asp"><img src="images/header.gif" width="773" height="90" border="0"></a></td>
</tr>

<tr valign="top">
<td colspan="3">  
<tr valign="top">
<td class="copy"><div align="right"><a href="index.asp">Home</a>  
</td>
</tr>


</table>
<br><br>
<tr>
<td width="50" valign="top"><img src="images/transparent.gif" width="50" height="10"></td>
<td width="1" valign="top">&nbsp;</td>
<td width="623" height="528" valign="top">



 
 
      <script language="JavaScript" type="text/javascript" src="Fill.js"></script>
 

 
 
      <TABLE width='600' border='0' cellpadding='0' cellspacing='0' class='copy'><TR valign='top'><TD><strong><font size='4'><BR>Help Desk Tracker</font></strong><BR><HR size=2 noshade color=#36578C></TD></TR></TABLE>
      
      <BODY>
      <TABLE border="0" cellspacing="3" cellpadding="3" class="copy" width="100%">
      <FORM ACTION="" METHOD="POST" NAME="HD" onSubmit="return SubmitForm()">
      
      <TR>
      <TD valign="top">&nbsp;</TD>
      <TD valign="top">&nbsp;</TD>
      </TR>

      <TR>
      <TD  valign="top">Date Received </TD>
      <TD valign="top">
      <INPUT TYPE="text" NAME="DateReceived" VALUE="" SIZE=10>

      <A HREF="#"  onClick="enterToday(this,HD.DateReceived)"  ID="DateReceived">

      <img src="images/calendaricon.gif" border="0" class="DatePicker" alt="click here to insert current date"/></A>
      </TD>
      </TR>
      
 
      <TR>
      <TD valign="top">Time Received </TD>
      <TD valign="top">
      <input name="TimeReceived" type="text" size="10"   value="" >        
      
      <A HREF="#"  onClick="enterTime(this,HD.TimeReceived)"  ID="TimeReceived">

      <img src="images/clock.jpg" border="0" class="DatePicker" alt="click here to insert current time"/></A>

 
      
      </TD>
      </TR>
      
      <TR>
      <TD>CAPT</TD>
      <TD>
      <SELECT NAME="CAPT" class="copy">
      <OPTION>>> Select >></OPTION>
      <option value='Name1'>Name1</option>
      <option value='Name2'>Name2</option>
 
      </SELECT>
      </TD></TR>


      <TR>
      <TD valign="top">Caller Alias </TD>
      <TD valign="top"><input name="CallerAlias" type="text" size="4" maxlength="4" value="">
      
      
      </TD>
      </TR>

      <TR>
      <TD valign="top">Caller Name </TD>
      <TD valign="top"><input name="CallerName" type="text" size="30" value=""></TD>
      </TR>      

      <TR>
      <TD>Office</TD>
      <TD>
      <SELECT NAME="Office" class="copy">
      <OPTION>>> Select >></OPTION>
      <option value='M'>M</option>
      <option value='N'>N</option>
      </SELECT>
      </TD></TR>

      <TR>
      <TD>Department</TD>
      <TD>
      <SELECT NAME="Department" class="copy">
      <OPTION>>> Select >></OPTION>
      <option value='Dept1'>Dept1</option>
      <option value='Dept2'>Dept2</option>      
      </SELECT>
      </TD></TR>
      
      <TR>
      <TD colspan="2" valign="top"><HR size=2 noshade color=#ecece4> </TD>
      </TR>


      <TR>
      <TD>Call Appropriate</TD>
      <TD>
      <SELECT NAME="CallAppr" class="copy">
      
      <OPTION>>> Select >></OPTION>
      <option value='Yes' >Yes</option>
       <option value='No' >No</option>
      </SELECT>
      </TD></TR>

      <TR>
      <TD>NetOp</TD>
      <TD>
      
      <SELECT NAME="NetOp" class="copy">
      
      <OPTION>>> Select >></OPTION>
      <option value='Yes' >Yes</option>
      <option value='No' >No</option>
      </SELECT>
      </TD></TR>



        
      <TR>
      <TD>Category</TD>
      <TD>
      <SELECT NAME="Category" onChange="SubmitCategory()" class="copy">
      <OPTION>>> Select a category >></OPTION>
       <option value='Hardware'>Hardware</option>
      <option value='Intranet / Internet'>Intranet / Internet</option>
      <option value='Issuances'>Issuances</option>
      </SELECT>
      </TD></TR>
      
      <TR>
      <TD>Subcategory</TD>
      <TD>
      <SELECT NAME="SubCategory" onChange="SubmitSubCategory()" class="copy">
      (<OPTION>>> Select a subcategory >></OPTION>)
      </SELECT>
      
        
      </TD></TR>
        
      <TR>
      <TD>Problem</TD>
      <TD>
      <SELECT NAME="Problem" class="copy">
      (<OPTION>>> Select a problem >></OPTION>)
      </SELECT>
      </TD></TR>       
      
      <TR>
      <TD valign="top">Additional problem description </TD>
      <TD valign="top">
        <textarea name="ProblemDesc" cols="40" rows="5"></textarea>
      </TD>
      </TR>
      
      <TR>
      <TD valign="top">Resoultion / Notes</TD>
      <TD valign="top">
        <textarea name="Notes" cols="40" rows="5"></textarea>
      </TD>
      </TR>

      <TR>
      <TD valign="top">Send To Specialist</TD>
      <TD valign="top">  
      <SELECT NAME="Status" onChange="SubmitSpecialist()" class="copy">
      
      <OPTION>>> Select >></OPTION>
      <option value='Closed' >Yes</option>
      <option value='Open' >No</option>
      </SELECT>
      

      
      </TD>
      </TR>

      <TR>
      <TD valign="top">Specialist</TD>
      <TD valign="top">         
       <SELECT NAME="Specialist" class="copy">
      
      </SELECT>
 

      <BR>
      <INPUT TYPE='HIDDEN' NAME='MAILSPEC' SIZE='6' VALUE=''>      
 
      </TD>
      </TR>

      <TR>
      <TD valign="top">Specialist Notes</TD>
      <TD valign="top">
        <textarea name="SpecialistComments" cols="40" rows="5"></textarea>
      </TD>
      </TR>


      <TR>
      <TD>&nbsp;</TD>
      <TD><INPUT TYPE="submit"  VALUE="Submit" CLASS="copy" onClick="return CheckTracker(this.form)" >&nbsp;
      <BUTTON CLASS="copy" onclick="window.location.href='index.asp';">Reset</BUTTON>
      </TD></TR>
      
 
      </FORM>       
      </TABLE>
      
0
BenMorelCommented:
Hi, this does work (tested).
Just write the onload only if the page has been submitted with ASP.

Ben
<body bgcolor="#36578c" TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0 onload="var e = document.forms[0].SubCategory; if (e.scrollIntoView) e.scrollIntoView();" >

Open in new window

0
pgoosemanAuthor Commented:

Ok.  Yes, I see that it does work from the onload.

However, the field SubCategory is 1/2 down the page so when you first load the page it scrolls down to this select menu immediately.  I would like it to scroll to SubCategory <select> area only after you have made a selection in the previous select menu called Category.  

The reason for this is because the SubCategory is populated based on what you select in the Category field so if you change the Category at anytime you will have to make a new selection in the SubCategory <select>.

Does that make sense ?

Thanks
0
BenMorelCommented:
That's why I suggested to write the onload only if the page has been submitted.
I don't know ASP, but I think it's something like :


<body bgcolor="#36578c" TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0 <% if ... Response.Write('onload="var e = document.forms[0].SubCategory; if (e.scrollIntoView) e.scrollIntoView();"' %> >

Open in new window

0
BenMorelCommented:
That should work :
<body bgcolor="#36578c" TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0 <% If UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" Then Response.Write('onload="var e = document.forms[0].SubCategory; if (e.scrollIntoView) e.scrollIntoView();"' End If %> >

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.