extjs - Ext Form Model load two fields with same data -


i have ext model form. need load single data value password field both password , confirm password field. possible load records in ext?

yes possible. when record loaded in form, data obtained calling getdata() on record. therefore, can tweak model provide copy of password in field this:

ext.define('user', {     extend: 'ext.data.model',     fields: [         'id',         'name',         'password'     ],     getdata: function() {         var data = this.callparent(arguments);         data['confirm_password'] = data['password'];         return data;     } }); 

full example: https://fiddle.sencha.com/#fiddle/pgr

alternative approach

if not want change model, password field mirror value confirm password field whenever value set through setvalue:

var form = ext.create('ext.form.panel', {     defaulttype: 'textfield',     items: [         {             fieldlabel: 'name',             name: 'name'         },         {             fieldlabel: 'password',             setvalue: function(value) {                 this.superclass.setvalue.apply(this, arguments);                 this.up('form').down('#confirm_password').setvalue(value);             },             //inputtype: 'password',             name: 'password',         },         {             fieldlabel: 'confirm password',             //inputtype: 'password',             name: 'confirm_password',             itemid: 'confirm_password'         }     ],     renderto: ext.getbody() }) 

full example: https://fiddle.sencha.com/#fiddle/pgt


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -