Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clear / set the password field emptyText onfocus / onblur?

Tags:

extjs

extjs4

I have password and confirm password fields that I want to display ********* in until the field gets focus.

var passwordFields = {
    layout: "vbox",
    border: 0,
    defaults: {
        xtype: "textfield",
        inputType: "password",
        labelAlign: "top",
        emptyText: "********",
        validateOnChange: false
    },
    items: [{
        fieldLabel: "Password",
        name: "pass",
        allowBlank : false,
        itemId: "pass"
    }, {
        fieldLabel: "Confirm Password",
        name: "pass-cfrm",
        allowBlank: false,
        initialPassField: "pass"
    }]
};

do I need to add an onfocus handler in order to make the emptyText go away when the field is in focus but the user hasn't typed anything or is there an easier way that I'm missing?

edit:

I added the following code to the controller which sets the value as needed depending on a flag but was hoping that the default behavior of the emptyText would be that it disappears onfocus and reappears after onblur if the field is empty...

var field = this.getPassField();
field.emptyText = "••••••••";
field.applyEmptyText();
like image 784
DaveAlger Avatar asked Nov 09 '12 12:11

DaveAlger


1 Answers

This issue can be resolved though the feature

inputType:'password'
like image 77
sakthi Avatar answered Oct 21 '22 04:10

sakthi