This is a migrated thread and some comments may be shown as answers.

OnKeyPress change Enter to Tab

1 Answer 104 Views
Input
This is a migrated thread and some comments may be shown as answers.
The Wire
Top achievements
Rank 1
The Wire asked on 23 Aug 2010, 05:32 PM
I have a RadNumericTextBox with the OnKeyPress client event set to test for the enter key.  If the Enter key is pressed, I'd like to change the event to do as if the Tab key was pressed.

Here is the Javascript:

function testForEnter(sender, args) {
    if (event.keyCode == 13) {
        event.keyCode=9;
    }
}

Is there a way to set the keyCode and switch the event from pressing Enter to pressing Tab?

Thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 25 Aug 2010, 09:04 AM
Hi,


You could explicitly focus to the next control when pressing Enter key in the NumericTextBox. Cancel the event using eventArgs.set_cancel(true); method and access the next control's client object, then call the focus() method to focus it.


-Shinu.
Tags
Input
Asked by
The Wire
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or