Skip to content

April 26, 2012

5

Create a password prompt dialog box on ExtJs 4

by Joe Kuan

I couldn’t find a way to create a prompt message box with password input field. Ext.Msg.prompt is really another way to call Ext.Msg.show with configuration object. Unfortunately, it doesn’t support inputType config option, like the textfield component.

However, this is the only way I know of

var msgbox = Ext.Msg.prompt('Password Prompt', 'Please enter a pasword');
msgbox.textField.inputEl.dom.type = 'password';
5 Comments Post a comment
  1. Elgar Storm
    Jun 20 2012

    The following code works with ExtJs 4.1 to change the input on Ext.Msg.prompt to password rather than clear text

    var myMsgBox = new Ext.window.MessageBox();
    myMsgBox.textField.inputType = ‘password’;
    myMsgBox.prompt(‘Title’,’Label’,function(btn,result) {
    if(btn==’ok’) {
    if(result!=null) { //handles cancel being hit on the prompt
    //use string the user input (stored in result) here in an appropriate manner
    }
    }
    });

    Reply
    • Joe Kuan
      Nov 16 2013

      Sorry for the late reply and thanks for pointing it out. It took me a while to figure out the issue. However, there is nothing wrong with the code in StoreMenu.js. It is to do with the adjusted rendering policy in ExtJs 4.2.1 on empty menu, i.e. no items option. In this case, you need to specify showEmptyMenu to force the menu rendering which I didn’t do in the demo code.

      I have updated the demo and documentation.

      Reply
  2. Jeff Sinclair
    Nov 13 2012

    Unfortunately the type of an IE8 textbox can not be changed.

    Reply
  3. john or not john
    Jul 11 2013

    thanks;)

    Reply

Trackbacks & Pingbacks

  1. extjs 4 login dialog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

%d bloggers like this: