fas*_*ava 11 javascript validation extjs
如何验证依赖于另一个字段的一个字段?
{
xtype: 'textfield',
name: 'name2',
vtype: 'type', // how to write the validation code for this if it
// depends on the value of another field?
allowBlank: false
}
Run Code Online (Sandbox Code Playgroud)
Chr*_*isR 25
通过添加您自己的自定义验证器并在其中执行验证.
var field_one = new Ext.form.TextField({
name: 'field_one',
fieldLabel: 'Field one'
});
var field_two = new Ext.form.TextField({
name: 'field_two',
fieldLabel: 'Field two',
validator: function(value){
if(field_one.getValue() != value) {
return 'Error! Value not identical to field one';
} else {
return true;
}
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
38199 次 |
| 最近记录: |