PDA

View Full Version : [2.2.1][Solved]FormPanel?validation????????????????



kaburk
11 Mar 2009, 7:13 PM
??????????????????
Ext.form.Field.prototype.msgTarget = 'side' ???????????????
datefield?timefield?????????????????????????
textfield?textarea??????????????????????????

???????????????????????????
????????????????layout:'absolute' ???????????????
?????????????????????????????:-?

yuki
11 Mar 2009, 10:36 PM
????????????????layout:'absolute' ???????????????


??????????absoute????????????layout?form??????????????????????????????????????????????????

??????????msgTarget:'side' ????????Field???????el??????????????????????????????????????????????????????????x-form-element???x-form-field-wrap???????????????????????

Field.getErrorCt

getErrorCt : function(){
return this.el.findParent('.x-form-element', 5, true) || // use form element wrap if available
this.el.findParent('.x-form-field-wrap', 5, true); // else direct field wrap
}

???????????????????layout:form??????????items???Field???????????el??x-form-element??????????div?wrap?????????????????????absolute??Field?wrap?????????????

???TriggerField???????DateField??TimeField?????????x-form-field-wrap????div?wrap????????layout:absolute?????????????????????????

???????????layout:form??????????

????Ext.Field.onRender????????
???????????

Ext.override(Ext.form.Field,{
onRender : function(ct, position){
Ext.form.Field.superclass.onRender.call(this, ct, position);
if(!this.el){
var cfg = this.getAutoCreate();
if(!cfg.name){
cfg.name = this.name || this.id;
}
if(this.inputType){
cfg.type = this.inputType;
}
this.el = ct.createChild(cfg, position);
}
var type = this.el.dom.type;
if(type){
if(type == 'password'){
type = 'text';
}
this.el.addClass('x-form-'+type);
}
if(this.readOnly){
this.el.dom.readOnly = true;
}
if(this.tabIndex !== undefined){
this.el.dom.setAttribute('tabIndex', this.tabIndex);
}

this.el.addClass([this.fieldClass, this.cls]);
this.el.wrap({cls: "x-form-field-wrap"});
}
});
????????wrap??

form.items.each(function(item){
if(item.isFormField){
item.on('render',function(t){
Ext.select('.x-form-field',false,t.body).each(function(el){
if(!el.findParent('.x-form-element', 5, true) && !el.findParent('.x-form-field-wrap', 5, true)){
el.wrap({cls: "x-form-field-wrap"});
}
});
})
}
});

????????????????????????????????FF3/OSX?

kaburk
12 Mar 2009, 5:07 PM
?????????????????????????????
??????????????????????????????=P~
????IE6,IE7,IE8,FF2.0,FF3.0,FF3.1b3,Opera9.64,safari3.2,Chrome2.0/WinXP?