logo

New Response

« Return to the blog entry

You are replying to:

    • avatar
    • Patrick Niland
    • Posted on Thu 6 Jul 2006 08:18 AM

    Hi Jake,

    This work's fine with fields that are displayed on the same form. But, you also need to take into account for when people use DHTML to show/hide sets of fields using tabs.

    In the above event, you can add an "onkeypress" event to detect if the tab key was pressed. If so, then change the tab (and set of fields) and focus on the next field.

    You will also need to allow for "SHIFT+TAB" to allow users to go back between tabs!

    Later

    Patrick

    (e.g.

    1. Last Field in First Tab

    onkeydown="CheckTab(1, 'tab2', 'First Field in Second Tab')"

    2. First Field in Second Tab

    onkeydown="CheckTab(0, 'tab1', 'Last Field in First Tab')"

    /********************************

    Name: CheckTab()

    Purpose: Used to allow for tab navigation (i.e. Using Tab Key) around the page and tabs.

    Input: intType = Tab Type (i.e. 1 = Forward, 0 = Backward)

    Output: None

    ********************************/

    function CheckTab(intType, strTab, strField)

    {

    // Check if tab key pressed

    if( (intType == 1 && !event.shiftKey && event.keyCode == 9) || (intType == 0 && event.shiftKey && event.keyCode == 9) )

    {

    // Click the Next Tab

    ClickTab(strTab);

    // Focus on the Field

    document.getElementById(strField).focus();

    }

    }

    /*******************************/

    )

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: