Something like this?
Code:
Ext.ns('Ext.ux.form');
Ext.ux.form.Checkbox = Ext.extend(Ext.form.Checkbox, {
blankText : 'This field is required',
getErrors : function() {
var errors = Ext.ux.form.Checkbox.superclass.getErrors.call(this);
if (this.allowBlank === false && !this.getValue()) {
errors.push(this.blankText);
}
return errors;
}
});
Ext.reg('ux-checkbox', Ext.ux.form.Checkbox);
Ext.onReady(function() {
new Ext.form.FormPanel({
renderTo : document.body,
title : 'Test',
monitorValid : true,
items : [
{
xtype : 'textfield',
fieldLabel : 'Test',
allowBlank : false
},
{
xtype : 'ux-checkbox',
fieldLabel : 'Test',
allowBlank : false
}
],
buttons : [
{
xtype : 'button',
text : 'Submit',
formBind : true
}
]
});
});