PDA

View Full Version : formBind question



madkris
17 Sep 2009, 6:33 AM
Hi guys,

I'll try to explain this as clearly as I can.

I have a FormPanel which has a config "monitorValid : true".
A Button which has a config "formBind : true".

Now comes the tricky part, below is my code for my checkboxgroup.

id: 'chkGroup',
xtype: 'checkboxgroup',
fieldLabel: {
text: 'Checkboxes',
cellCls: 'x-cell-top-label'
},
columns: 2,
width: 250,
allowBlank: false,
items: [{
width: 100,
items: [{
name: 'chk[]',
boxLabel: 'check 1',
inputValue: 1
},
{
name: 'chk[]',
boxLabel: 'check 3',
inputValue: 3,
listeners: {
'check': {
scope: this,
fn: function () {
this.findById('chkGroup').items.get(3).fireEvent('myEvent');
}
}
}
}]
},
{
items: [{
width: 100,
name: 'chk[]',
boxLabel: 'check 2',
inputValue: 2
},
{
id: 'txtCheck',
xtype: 'textfield',
width: 80,
disabled: true,
allowBlank: false,
listeners: {
'myEvent': {
fn: function () {
return this.disabled ? this.enable() : this.disable();
}
}
}
}]
}]As you may have noticed, I have set my TextField to "disabled: true, allowBlank:false". I placed a listener which handles the enabling and disabling of the TextField whenever checkbox 3's check event is fired, allowing me to input into the TextField.

Now comes the problem, the button which has the "formBind : true" config. enables without waiting for an input in my TextField.

I know I could put a listener in my button but I was wondering if there was another way which would solve my problem and use the formBind feature of the FormPanel.

Many thanks,
- kris

madkris
18 Sep 2009, 1:45 AM
bump. :)