Setting focus after VBScript processing

Discussion in 'ASP General' started by Drew, Feb 16, 2005.

  1. Drew

    Drew Guest

    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
    Drew, Feb 16, 2005
    #1
    1. Advertising

  2. 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.
    Bob Barrows [MVP], Feb 16, 2005
    #2
    1. Advertising

  3. Drew

    Adrienne Guest

    Gazing into my crystal ball I observed "Drew"
    <> writing in
    news::

    > 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
    Adrienne, Feb 22, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dmedina
    Replies:
    0
    Views:
    940
    dmedina
    Jun 25, 2003
  2. Vinod I
    Replies:
    2
    Views:
    411
    Peter Blum
    Feb 4, 2004
  3. Jason
    Replies:
    4
    Views:
    1,617
    Jason
    May 7, 2007
  4. TheDrifter
    Replies:
    1
    Views:
    556
    Gaurav Vaish \(a.k.a. MasterGaurav\)
    Jul 23, 2008
  5. Roger
    Replies:
    3
    Views:
    321
Loading...

Share This Page