Solved

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

Posted on 2012-03-30
2
250 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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