Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8738689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:46:50+00:00 2026-06-13T10:46:50+00:00

I’ve written a wrapper UX control in Ext JS 2.x around Ext.Form.DateField to handle

  • 0

I’ve written a wrapper UX control in Ext JS 2.x around Ext.Form.DateField to handle keypresses slightly differently. In particular, when the calendar is on display, I want the Tab key to select the highlighted date and move to the next form field.

I’ve got the key handler working – it selects the highlighted date and closes the calendar – but I can’t get it to tab to the next field.

Do I have to work out what the next field is from the tab order and try to set its focus? That seems rather convoluted. Or can I fire some event to get my control to tab to the next field automatically (i.e. capture the Tab keypress in the calendar and process it, as I am doing, but then forward it to the underlying date field)?


Edit: In summary, is there an Ext (or, at least cross-platform) way to fire a keyboard event at a particular form field?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:46:51+00:00Added an answer on June 13, 2026 at 10:46 am

    Approach I. Just don’t do event.preventDefault() in your keypress/keyup event handler so you don’t block the browser from performing the default action, i.e. tab-navigation. This example works:

    Ext.create('Ext.form.Panel', {
        title: 'Contact Info',
        width: 300,
        renderTo: Ext.getBody(),
        items: [{
            xtype: 'textfield',
            name: 'name',
            fieldLabel: 'Name',
            listeners: {
                specialkey: function(me, e) {
                    if (e.getKey() == e.TAB) {
                            console.log('Tab key pressed!');
                            // do whatever you want here just don't do e.preventDefault() or e.stopEvent() if you want the browser tab to next control
                        }
                }
            }
        }, {
            xtype: 'textfield',
            name: 'email',
            fieldLabel: 'Email Address',
        }]
    });
    

    I tried it in Ext 4 but all the essential methods should be available since Ext 2.
    If you still experience issues please share some of your code.

    Getting out of the way and letting the browser do its stuff natively is usually the best and the most robust solution…


    Approach II. If you have a complicated component with multiple elements, you can still achieve the case of Approach I. by forcing the focus on the main input element (usually a text field) while simulating focusing items inside a popup element with CSS (a KeyNav/KeyMap in the main input element would be handy here). You just basically catch all the cases where the user may set the focus on a popup (like clicking on it) and snap the focus back to your main element.

    This would still ensure the natural tab order of html elements, even if some of them are not Components. I believe that’s the best way to go and worth struggling to achieve most of the time.

    That’s the way components like ComboBox and DatePicker work (as you can see the latter just always sets focus to the main element after the vaule is updated. The focus logic of a ComboBox is a bit more complicated. Take a look at the source code links if you’re confused about how to implement it in your component, very insightful.


    Approach III. Last resort. If you still need to just programmatically focus another (neighbour) field, that’s relatively easy to do.
    Code for Ext 2.3 (didn’t test it though, I was using the docs):

    var formPanel,  // containing form panel
        currentField, // the field you need to navigate away from
    
        fields,
        currentFieldIdx,
        nextField;
    
    fields = formPanel.getForm().items;
    currentFieldIdx = fields.indexOf(currentField);
    
    if(currentFieldIdx > -1) {
        nextField = fields.itemAt(currentFieldIdx + 1);
        nextField && nextField.focus();
    }
    

    P.S. You can artificially fire the Tab key press via dispatchEvent() but it will not trigger the tab-navigation action due to security reasons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I am using Paperclip to handle profile photo uploads in my app. They upload
i want to parse a xhtml file and display in UITableView. what is the
Let's say I'm outputting a post title and in our database, it's Hello Y’all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.