Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now