GIGJ.COM
welcome to my space
X
Welcome to:gigj.com
Search:  
NAVIGATION - HOME
Focus on textbox on load of Ext.Msg.show Dialog window
Published by: mike 2010-03-17

  • Hi,
    I have a Ext.Msg.show dialog that appears for a user to create a new folder or rename a folder within a folder tree. I would like it if on load of the dialog window, the textbox was in focus so that the user could immediately start typing a new name without having to click on it but I cant seem to get it to work in IE or firefox. the normal select() or focus() methods dont work. I have tried:

    var name = document.getElementById("newName");
    setTimeout("name.focus();", 0);
    name.focus();
    name.select();

    However none of those seem to work. Any suggestions?:s


  • The show method is an asynchronous operation; that is the code immediately following it will likely execute before the messagebox has been created and rendered. It does have the ability to accept a callback function via the 'fn' config option though, and this would be the appropriate place to put your focus code. See the API docs for Ext.MessageBox.show() for more details.
    And in the future please use code tags when posting code, it is very hard to read code without formatting.


  • This is my dialog box. the id of the variable textToShow is "newName".

    Ext.Msg.show({
    cls: 'dialog-border',
    closable: false,
    focus:true,
    title: Mistic.constants.newFolderMessages.TITLE,
    msg: Mistic.constants.newFolderMessages.MESSAGE_BEGIN +
    textToShow +Mistic.constants.newFolderMessages.MESSAGE_END +
    Mistic.constants.textBoxes.WRITE_SIZE_35+
    Mistic.constants.textBoxes.CLOSE_TAG,
    buttons: Ext.Msg.OKCANCEL,
    how to set focus on a field in a dialog? - Ext JS Forums::
    10 posts - Last post: Dec 12, 2007Send a private message to bwang_dal · Find all posts by bwang_dal . dialog.on ('show', function() { Ext.fly('myTextBox').focus(); });
    http://extjs.com/forum/showthread.php?p=98263
    HOME
    width: 375,
    value: valueText,
    fn: function(button) {
    var folderName = document.getElementById("newName").value;
    if (button == Mistic.constants.buttonLabels.EXT_TEST_OK){
    if(folderName == Mistic.constants.messages.BLANK_STRING) {
    Mistic.events.alertMessage({
    title: Mistic.constants.newFolderMessages.MESSAGE_NO_NAME _ENTERED_TITLE,
    msg: Mistic.constants.newFolderMessages.MESSAGE_NO_NAME _ENTERED_CONTENT,
    fn: function(button){
    if(button == Mistic.constants.buttonLabels.EXT_TEST_OK){
    newNameMessage(valueText, parentNode, textToShow);
    }
    }
    });
    }
    else if(folderName.length > 50) {
    Ext.Msg.alert(Mistic.constants.newFolderMessages.M ESSAGE_50_CHARACTERS_TITLE,
    Mistic.constants.newFolderMessages.MESSAGE_50_CHAR ACTERS);
    createNewItem(obj, ee, folderName);
    }
    else {
    var myNode = parentNode;
    var myReader = new Ext.data.JsonReader({},
    Ext.data.Record.create());
    var addAjax = Mistic.ux.Ajax.request({
    url: Mistic.appUrl +
    Mistic.constants.newFolderMessages.URL_NEW_FOLDER_ ACTION,
    params:
    {
    parentId: parentNode.id,
    folderName: Mistic.mainWin.Mistic.events.replaceChars(folderNa me),
    folderType: (parentNode.attributes.folderType ?
    parentNode.attributes.folderType : 'MAIL')
    },
    success:function(ajax, response){
    Mistic.mainWin.Mistic.mua.refreshFolderManagerTree ()
    },
    failMessage: Mistic.constants.messages.ERROR_ADD
    });
    myNode.customExpand = true;
    myNode.parentNode.expanded = true;
    }
    }
    }
    });


    document.getElementById("newName").focus();


  • I call the code after the creation of the Ext.Msg.show.


  • When are you calling this code in relation to when the dialog is shown?





  • Nortel Unveils Vision, Strategy for Israeli High-Performance Net
    Busy Friday Leads to Strong Close for Net Stocks

    You are looking at:gigj.com's Focus on textbox on load of Ext.Msg.show Dialog window, click gigj.com to home
  • which party would be the most likely to pass this history test
  • are miley and nick jonas dating
  • what are some good rap artists
  • hair curly vs straight
  • laws and regulations for emergency preparedness planning
  • pre algebra question we need help with this
  • i think im in love with the jonas brothers any help
  • who is nick jonas dating and its not miley
  • bret hart the hit man is in detroit
  • who would you rather date nick kevin or joe jonas
  • what should i be for halloween
  • what kind of hairstyles can i do with this cut pics inside
  • how do i go about getting my hands on wwe tickets
  •  
  • what about cyber school
  • i am 13 i 039 m pretty but theres a problems help
  • could i model i think i have a good chance pics included
  • joe jonas fans is he dating
  • why do most kids go through a stage where they love cheesy pop music like the jonas brothers
  • is nick jonas dating anyone right now
  • songs not playing on my ipod nano
  • who is nick jonas dating now
  • what is html and css
  • is joe jonas and miley cyrus dating
  • school pranks for highschool
  • why do girls like funny guys instead of nice guys
  • important ipod help urgent
  • is nick jonas dating anyone as of june 27 2008
  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Focus on textbox on load of Ext.Msg.show Dialog window , Please add it free.

    About us -Site map -Advertisement -Jion us -Contact usExchange linksSponsor us
    Copyright© 2008 gigj.com All Rights Reserved
    Site made&Support support@gigj.com    E-mail: web@gigj.com