Home > Archive > ASP > February 2005 > Setting focus after VBScript processing
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Setting focus after VBScript processing
|
|
|
| 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%"> </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%"> </td>
<td width="82%"><input name="event1" type="text" id="event1"></td>
</tr>
</table>
</form>
Thanks,
Drew Laing
| |
| Bob Barrows [MVP] 2005-02-16, 3:56 pm |
| 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.
| |
| Adrienne 2005-02-22, 8:55 am |
| Gazing into my crystal ball I observed "Drew"
<drew.laing@NOswvtc.dmhmrsas.virginia.SPMgov> writing in
news:O3xPXXDFFHA.392@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%"> </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%"> </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
|
|
|
|
|