Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExtJS How to modify the textfield parameter autocomplete="off"

Tags:

extjs

extjs4

Some modern (Safari, chrom, firefox) browser records informations and allows you to autocomplete some textfields when you come back.

I want to do it in ExtJS. I have a piece of answer here :

How to get Chrome to remember login on forms?

But in ExtJS, I can not access to the parameter autocomplete. It is always hard coded autocomplete="off". In the doc, I do not found how to modify it : http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Text

Is someone has a simple answer to modify this parameter ?

like image 913
Farandole Avatar asked Oct 08 '12 14:10

Farandole


1 Answers

You want to add an afterrender listener to the textfield, get a reference to the input element, and set its autocomplete attribute to "on". You probably also want to set its name (as that is how the browser remembers the value).

Example:

http://jsfiddle.net/4TSDu/19/

{
    xtype:'textfield',
    fieldLabel:'some field',
    name:'somefield',
    listeners:{
        afterrender:function(cmp){
            cmp.inputEl.set({
                autocomplete:'on'
            });
        }
    }
}
like image 187
Neil McGuigan Avatar answered Sep 28 '22 18:09

Neil McGuigan