PDA

View Full Version : [INFOREQ] compositefield don't send any valid event



Trey
18 May 2010, 12:40 AM
In the API doc, compositefield have a "valid" event, but the event is never throw by the compositefield.
ex :
{
xtype:'compositefield',
fieldLabel:'test',
listeners:{
valid:function(){console.log("ok");}
},
items:[
{
xtype:'spinner',
listeners:{
valid:function(){console.log("ok");}
}
}
]

Jamie Avins
18 May 2010, 8:34 AM
I'm having some difficulty following you. Perhaps if you followed the bug forum guidelines: http://www.extjs.com/forum/showthread.php?71015-Posting-to-the-Bug-Forum we might be able to help.

Trey
20 May 2010, 6:11 AM
Ext version tested:


Ext 3.2.1



Adapter used:


ext



css used:


only default ext-all.css





Browser versions tested against:


FF3 (firebug 1.3.0.10 installed)



Operating System:


Win Vista



Description:


I have a compositefield with, for example, a textfield.
When I set a value in the textfield, I dont have any "valid" event throw by the compositefield.
How can I be warn when the textfield is valid ?



Test Case:

[CODE]
{
xtype:'compositefield',
fieldLabel:'test',
listeners:{
valid:function(){
console.log("ok");// never throw
}
},
items:[
{
xtype:'spinner',
listeners:{
valid:function(){
console.log("ok");}
}
}
]
}

hendricd
20 May 2010, 2:49 PM
I believe OP is looking for the child field events to be relayed to the parent Composite field. ;)

rmesser
26 Jan 2011, 3:06 PM
Further note -- events from items contained in a composite field don't bubble up, even if "bubbleEvents" is set. That seems to be because the ownerCt of the items are an Ext.Container built on the fly inside initComponent of Ext.form.CompositeField. Then then ownerCt of the Ext.Container is set to undefined, so there is no link from composite field items to their parent form.

This particular issue may have been reported in other places, but I thought I'd mention it led me to waste several hours trying to debug form validation. Basically the Ext.field.CompositeField class seems to be broken in a few ways, probably mostly related to the fact that the items inside the CompositeField are left inside an orphaned container.

Gnafu
26 Aug 2013, 4:07 AM
The CompositeField owerwrite the behaviour on validation of its children when combineErrors is TRUE (is the default setting).

If you are using a compositeField with a single child, you are misusing the compositeField, it's ment to be used with more fields (to "compose" them) and the validation should be done alltogether.