Results 1 to 2 of 2

Thread: Skipping over input boxes - cursor flow

  1. #1
    Guest
    I have a table created with code on an ASP page that allows a user to key in a product id, quantity & weight.
    It looks like this

    Product Id Quantity Weight
    __________ ________ ______
    __________ ________ ______
    __________ ________ ______
    __________ ________ ______
    __________ ________ ______


    I would like to have the product id entered once and then it will be copied down each line once the form is submitted. I would like to have the cursor positioned to the quantity field of the next row once the tab key is pressed from the prior row's weight field.

    Any ideas?

  2. #2
    Guest
    One way you might be able to do it is if your inputs (and their JavaScript) where dynamically generated (via ASP) and named with some kind of numbering scheme. The HTML produced by your ASP would look something like:

    <TABLE>
    <TR>
    <TD><INPUT NAME="prod_id_1"></TD>
    <TD><INPUT NAME="qty_1"></TD>
    <TD><INPUT NAME="wt_1" onBlur="qty_2.focus()"></TD>
    </TR>
    <TR>
    <TD><INPUT NAME="prod_id_2"></TD>
    <TD><INPUT NAME="qty_2"></TD>
    <TD><INPUT NAME="wt_2" onBlur="qty_3.focus()"></TD>
    </TR>
    <TR>
    <TD><INPUT NAME="prod_id_3"></TD>
    <TD><INPUT NAME="qty_3"></TD>
    <TD><INPUT NAME="wt_3" onBlur="qty_4.focus()"></TD>
    </TR>
    <!-- Etc, etc... -->
    </TABLE>

    If you wanted the product id copied to the next automatically too (without form submission) you could do something like:

    <TABLE>
    <TR>
    <TD><INPUT NAME="prod_id_1"></TD>
    <TD><INPUT NAME="qty_1"></TD>
    <TD><INPUT NAME="wt_1" onBlur="prod_id_2.value=prod_id_1.value;qty_2.focus();"></TD>
    </TR>
    <TR>
    <TD><INPUT NAME="prod_id_2"></TD>
    <TD><INPUT NAME="qty_2"></TD>
    <TD><INPUT NAME="wt_2" onBlur="prod_id_3.value=prod_id_2.value;qty_3.focus();"></TD>
    </TR>
    <TR>
    <TD><INPUT NAME="prod_id_3"></TD>
    <TD><INPUT NAME="qty_3"></TD>
    <TD><INPUT NAME="wt_3" onBlur="prod_id_3.value=prod_id_4.value;qty_4.focus();"></TD>
    </TR>
    <!-- Etc, etc... -->
    </TABLE>

    Dunno if this helps...
    Paul


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width