Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

10 Experts available now in Live!

Get 1:1 Help Now