By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,978 Members | 1,467 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,978 IT Pros & Developers. It's quick & easy.

Setting focus after VBScript processing

P: n/a
I have a form which has 1 textbox in it. When the user enters a number, and
tabs, it submits the form and the textbox disappears and the name of the
person that the ID corresponds to is displayed (filters recordset, returns
name). The problem I have is that this is the first textbox on the page,
and when the user tabs, the tab order gets funky and the user has to click
on the next textbox. This is unacceptable to my data entry people, as they
are used to tabbing everywhere. Does anyone have any ideas?

Here is my code for the 2 forms (the RS is created earlier),

<form action="addEvent.asp" method="post" name="Name1" id="Name1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%">Reg. # </td>
<td width="2%">&nbsp;</td>
<td width="82%">
<%If Request.Form("RegNo1") = "" Then%>
<input name="RegNo1" type="text" id="RegNo1"
onChange="document.Name1.submit();document.event1. event1.focus();;">
<%Else
If rsCliName.EOF AND rsCliName.BOF Then
Response.Write("No Resident")
Else
Response.Write(rsCliName("CliFName") & " " &
rsCliName("CliLName"))
End If
End If%>
</td>
</tr>
</table>
</form>
<form action="" method="post" name="event1" id="event1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%">Event</td>
<td width="2%">&nbsp;</td>
<td width="82%"><input name="event1" type="text" id="event1"></td>
</tr>
</table>
</form>

Thanks,
Drew Laing
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Drew wrote:
This has nothing to do with ASP (which is server-side). For client-side
questions, try one of the scripting newsgroups: .scripting.vbscript (based
on your subject), or better yet .scripting.jscript (it's not recommended to
use vbscript in client-side code)

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '05 #2

P: n/a
Gazing into my crystal ball I observed "Drew"
<dr********@NOswvtc.dmhmrsas.virginia.SPMgov> writing in
news:O3*************@TK2MSFTNGP14.phx.gbl:
I have a form which has 1 textbox in it. When the user enters a
number, and tabs, it submits the form and the textbox disappears and
the name of the person that the ID corresponds to is displayed (filters
recordset, returns name). The problem I have is that this is the first
textbox on the page, and when the user tabs, the tab order gets funky
and the user has to click on the next textbox. This is unacceptable to
my data entry people, as they are used to tabbing everywhere. Does
anyone have any ideas?

Here is my code for the 2 forms (the RS is created earlier),

<form action="addEvent.asp" method="post" name="Name1" id="Name1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%">Reg. # </td>
<td width="2%">&nbsp;</td>
<td width="82%">
<%If Request.Form("RegNo1") = "" Then%>
<input name="RegNo1" type="text" id="RegNo1"
onChange="document.Name1.submit();document.event1. event1.focus();;">
<%Else
If rsCliName.EOF AND rsCliName.BOF Then
Response.Write("No Resident")
Else
Response.Write(rsCliName("CliFName") & " " &
rsCliName("CliLName"))
End If
End If%>
</td>
</tr>
</table>
</form>
<form action="" method="post" name="event1" id="event1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%">Event</td>
<td width="2%">&nbsp;</td>
<td width="82%"><input name="event1" type="text"
id="event1"></td>
</tr>
</table>
</form>

Thanks,
Drew Laing


<form action="addevent.asp#event1" method="post">
will make the page automatically jump to id event1. You should also use
the tabindex attribute on your input elements. Get away from using tables
for forms, use CSS (cleaner, faster, easier to debug -
<http://www.intraproducts.com/beta/requiredform.asp> has examples).
--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.