1. #1
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
    psewt is on a distinguished road

      0  

    Default Unanswered: How to focus on input type password in the dialog?

    Unanswered: How to focus on input type password in the dialog?


    I have this dialog showing input field for a password. I need to focus on the input field after the dialog is shown. How can I do it?

    Code:
         Ext.MessageBox.show({
          title: 'Password',
          msg: 'Password:<br/><input id="passwordInput" type="password"/>',
          buttons: Ext.MessageBox.OKCANCEL,
          fn: function(btn) {
            if (btn == "ok") {
              submitPassword();
            }
          }
        });

  2. #2
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    434
    Answers
    21
    Vote Rating
    37
    suzuki1100nz has a spectacular aura about suzuki1100nz has a spectacular aura about suzuki1100nz has a spectacular aura about

      0  

    Default


    Hi Have a look at the api sample - http://docs.sencha.com/touch/2-1/#!/api/Ext.Msg

  3. #3
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
    psewt is on a distinguished road

      0  

    Default


    Quote Originally Posted by suzuki1100nz View Post
    Hi Have a look at the api sample - http://docs.sencha.com/touch/2-1/#!/api/Ext.Msg
    I'm sorry but this doesn't help me, I forgot to me mention that I need it to do in ExjJS 4 on a normal desktop.

  4. #4
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    434
    Answers
    21
    Vote Rating
    37
    suzuki1100nz has a spectacular aura about suzuki1100nz has a spectacular aura about suzuki1100nz has a spectacular aura about

      0  

    Default


    Look at the example with a text field.
    What are you trying to do?
    Give some context - Is this a user loging into an app?
    Is this a user actioning a use case that requires a password verification?

    ?????

    A message box may not be the best way to handle this

  5. #5
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
    psewt is on a distinguished road

      0  

    Default


    Quote Originally Posted by suzuki1100nz View Post
    Look at the example with a text field.
    What are you trying to do?
    Give some context - Is this a user loging int an app?
    Is this a user actioning a use case that requires a password verifiction?

    ?????

    A meesage box may not be the best way to handle this
    Sorry I did expect the case is clear. It is a normal modal password dialog which pops up for a user to enter the password and I want to focus on the input field right after the popup. The input field needs to be of type password, hence the code above may look a bit untraditional, but it works, the problem is only that I don't know how to focus, because this dialog runs asynchronously and when I do set focus after the code it does not work:

    Code:
    Ext.MessageBox.show({
      title: 'Password',
      msg: 'Password:<br/><input id="passwordInput" type="password"/>',
      buttons: Ext.MessageBox.OKCANCEL,
      fn: function(btn) {
        if (btn == "ok") {
          submitPassword();
        }
      }
    });
    
    Ext.get('passwordInput').focus(); // not working

  6. #6
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    434
    Answers
    21
    Vote Rating
    37
    suzuki1100nz has a spectacular aura about suzuki1100nz has a spectacular aura about suzuki1100nz has a spectacular aura about

      0  

    Default


    Apologies re the link to a touch messagebox I meant to post this.
    http://docs.sencha.com/ext-js/4-1/#!...dow.MessageBox

    ok - Again not sure why you don't just use an ExtJS textfield as I suggested.
    It has a config called inputType. A message box is a window so you can add component config to it. look at the example using the method show.
    Set inputType config on the textfield to "password" and it will do the masking.
    When the message box displays, ExtJS will set the focus to the field for you.
    No special code needed.

    If you want to progress with what you've done, you will need to create an onRender listener and in the fired function call focus.
    This will ensure the message box is in the dom before focus is called.

  7. #7
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
    psewt is on a distinguished road

      0  

    Default


    Do you have some working example? I've already spent few days and tried lot of solutions on this but I really don't know how to do it.
    Ext.MessageBox is a singleton, so how can I pass config to it? How can I add the ExtJS textfield to it?
    I've tried to add the listener to the show function, but it does not work, because it does not have listener config. The inputType: 'password' does not work either.
    I'm a beginner so I really need a working example.


    Code:
    Ext.MessageBox.show({
      title: 'Password',
      msg: 'Password:<br/><input id="passwordInput" type="password"/>',
      buttons: Ext.MessageBox.OKCANCEL,
      fn: function(btn) {
        if (btn == "ok") {
          submitPassword();
        }
      },
      listeners: {
        render: function() {
          Ext.get('passwordInput').focus();
        }
      } 
    });

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar