Solved

Stop Jumping of input screen when selecting enter button to move from field to field

Posted on 2012-03-30
2
251 Views
Last Modified: 2012-03-30
Hello everyone,

I have a web form that is jumping each time the user moves from textbox fields and drop down fields when data is entered using the Enter Key.  

Someone gave me this code to stop the jumping, but I do not know where to place the coding to completely stop the jumping in the web form.

The coding:  onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;">

I need this coding above to apply to the entire web form.  Do I need to enter this coding on every field in the HTML coding screen?

jjc9809
0
Comment
Question by:jjc9809
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 37788067
You can put the code in one function and then associate that function with keypress of each textbox. What do you mean by jumping by the way?
0
 

Author Comment

by:jjc9809
ID: 37788576
CodeCruiser,

I have set each textbox TextChanged event to check if the textbox >= Nothing Then
set the focus to the next textbox or drop downlist.

For example on the textbox DriverLicense_ID, I have this vb coding in the textchanged
event.  

        Protected Sub PK_DriverLicenseID_vch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PK_DriverLicenseID_vch.TextChanged

        If PK_DriverLicenseID_vch.Text >= Nothing Then
            DDLState.Focus()
        End If
    End Sub

This takes the cursor to DDLState drop down list when the enter button is selected.

For example on the dropdownlist field, DDLState I have this vb coding in the SelectedIndexchanged event.

Protected Sub DDLState_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DDLState.SelectedIndexChanged
        If DDLState.SelectedIndex >= Nothing Then
            DDLFK_IntelligenceType_vch.Focus()
        End If
    End Sub




The screen movement or jump is occuring when the enter button is selected.  Maybe my coding  above is doing this.  The textbox has the property set for autopostback as "true" on every field.  If I set the autopostback to false, the cursor does not go to the next field which in this case is the drop down list DDLState.  I want the cursor to go to the next field after enter is selected.  

jjc9809
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question