I'm using Classic ASP on a Windows 2000 server to direct a handheld running Wiindows CE to input a barcode scan to SQL. My problem is that I can't set focus to the input textbox on the hand held scanner. My code below is using a java script to reset focus and it works on my desktop IE 6 and 7 however it dosn't work for the hand held.
Chuck
<html>
<head>
<meta http-equiv="Content-Langua
ge" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.
Document">
<title>Scan Bags</title>
<!-- #Include Virtual = "ASPMaster.asp" -->
<!-- #Include Virtual = "CityMaster.asp" -->
<% Step = Request.QueryString("Step"
) %>
<% If Step = "" Then Step = "Scan" %>
<% M = Request.QueryString("M") %>
<SCRIPT LANGUAGE="JavaScript">
<!--
Begin
function putFocus(formInst, elementInst) {
if (document.forms.length > 0) {
document.forms[formInst].e
lements[el
ementInst]
.focus();
}
}
// The second number in the "onLoad" command in the body
// tag determines the form's focus. Counting starts with '0'
// DON'T FORGET TO LOOK AT THE BODY TAG FOR THE KEY TO THIS SCRIPT
End
-->
</script>
<style>
<!--
div.Section1
{page:Section1;}
-->
</style>
</head>
<BODY onload="PutFocus(0,0);" topmargin="0" leftmargin="0" >
<%
If Step = "Scan" Then %>
<% If Request.Form("ScanLocation
") <> "" Then %>
<% Session("ScanLocation") = Request.Form("ScanLocation
") %>
<% End If %>
<% 'If Session("ScanLocation") = "" Then Session("ScanLocation") = Session("ScanLocation") %>
<form method="POST" action="Scan.asp?City=<% = Session("City") %>&Step=Insert" onsubmit="return FrontPage_Form1_Validator(
this)" name="FrontPage_Form1" >
<table>
<tr>
<td align=left colspan="2" style="border: 1 solid #000000"><b><font face="Verdana" size="3">Scan Bags</font></b></td>
</tr>
<tr>
<td align=left colspan="2"><% = session("city") %>/<% = Session("ScanLocation") %></td>
</tr>
<tr>
<td align=left><font size="1" face="Trebuchet MS">Scan Bag Or<br>
Manually Input<br>
10-Digit Tag Number</font></td>
<td>
<!--webbot bot="Validation" s-display-name="FullTag" s-data-type="Integer" s-number-separators="x" b-value-required="TRUE" i-minimum-length="10" i-maximum-length="10" --><INPUT type=text name=BagTag size=10 maxlength=10 stiscan="ABCDEFGHIJKL" stisubmit tabindex=0 class="Section1" id="0" ></td>
</tr>
<% If M = "Accepted" Then %>
<tr>
<td align=left colspan="2" bgcolor="#000000"><b><font
color="#FFFFFF" face="Verdana">Scan Accepted!</font></b></td>
</tr>
<% End If %>
</table>
<table>
</form>
<% End If %>
<% If Step = "Insert" Then %>
<% FullTag = Request.Form("BagTag") %>
<% If Session("City") = "" Then Response.Redirect "
http://rovingagent.aa.com" %>
<% If FullTag = "" Then Response.Redirect "
http://rovingagent.aa.com" %>
<% If Session("ScanLocation") = "" Then Response.Redirect "
http://rovingagent.aa.com" %>
<% Dim Obj
Dim RS
Dim CM
Dim CN
Set CN = Server.CreateObject("ADODB
.Connectio
n")
Set CM = Server.CreateObject("ADODB
.Command")
Set RS = Server.CreateObject("ADODB
.RecordSet
")
strSQL = "sp_insert_tblscan_manual"
CN.Open Application("CITY_TODAY")
CM.ActiveConnection = CN
CM.CommandText = strSQL
CM.CommandType = adCmdStoredProc
CM.Parameters.Append CM.CreateParameter("City",
adVarChar, adParamInput, 3, UCASE(Session("City")))
CM.Parameters.Append CM.CreateParameter("FullTa
g", adVarChar, adParamInput, 10, FullTag)
CM.Parameters.Append CM.CreateParameter("Locati
on", adVarChar, adParamInput, 10, Session("ScanLocation"))
CM.Execute
Response.Redirect "
http://0.0.0.0/scan/scan.asp?Step=Scan&M=Accepted"
%>
<% End If %>
<td><b><font face="MS Sans Serif" size="3">Also</font></b>
<p><a href="
http://0.0.0.00/index.asp?City=<% = Session("City") %>"><font face="MS Sans Serif" size="2">Home</font></a><f
ont face="MS Sans Serif" size="2">
|<a href="Location.asp?City=<%
= Session("City") %>&SC=None">Change Scan Location</a></font></p>
<td>
</table>
</body>
Start Free Trial