Setting focus after VBScript processing

D

Drew

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
 
B

Bob Barrows [MVP]

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
 
A

Adrienne

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top