View Full Version : FormPanel - unable to find field when using composite fields or fieldsets

29 Apr 2010, 3:07 AM
Hi all,

I am currently prototyping an application where I have created a great scalable form panel organising the fields using fieldsets and composite fields. It looks great but I have hit a problem when I have to set attributes on one field dynamically based on a selection in a combo box. I can see many ways to do this when not using fieldsets and composite fields but when I introduce these constructs, I seem to be unable to find the parent form from within a field event handler and I seem to be unable to find the field or component from the parent formPanel or form. This is the case even if I add the code in the afterrender event.

I have seen a few posts highlighting similar issues but also comments that this has been resolved in 3.x.

Am I missing something here. Shouldn't I be able to find the parent formPanel from within a composite field or a field set or finding a field from within the events of the parent form? It seems to me as a very basic issue. Any help greatly appreciated.

Kind Regards


3 May 2010, 7:54 PM
Hi again,

I haven't received any response on this question. I think it is a fairly fundamental functionality and are very puzzled if this is not supported and significantly reduces the usability of composite fields and field sets in a production application as if used, you can't reference the nested field if needed in the future. Any help is greatly appreciated.

6 May 2010, 10:27 AM
I'm running into a similar issue (i think). I have a composite field consisting of a ComboBox and a button. When the button is clicked, I want to grab the value of the combo and place it in a grid below. Unfortunately, I can't seem to find a way to access anything inside the composite. Why doesn't the 'ref' attribute work? or 'itemId'? Can anyone on the Ext.js team pleas explain how to access composite elements?

6 May 2010, 3:07 PM
Same problem here...

Composite fields have quite a few issues it appears, as this is the Xth problem I have with them.

14 May 2010, 5:10 AM
Is anyone from Ext.js going to look at this, or just keep ignoring it? I've seen others on the web and in the forum complaining about this issue as well.

The Composite type could very useful if we had a way of accessing components inside it. (other than creating variable references in the code).

I got around this issue by creating a hard reference in the class...

var _field1 = Ext.form.TextField(...);
var _field2 = Ext.form.TextField(...);
var _composite = {
items:[_field1, _field2]

This way I can reference the variables in events,etc in the class. Crappy, but it works.

23 Nov 2010, 10:43 AM
Same problem here. I got around it by using xtype:'container' with layout:'hbox' in place of whatever used to be xtype:'compositefield'. You can even still use fieldLabel:'myField' and it will be rendered correctly by the parent container (assuming it is layout:'form', of course).

Edit: apparently findParentBy* functions are broken by compositefield, which is a known issue (http://www.sencha.com/forum/showthread.php?114208-findParentBy-and-findParentByType-methods-are-broken-in-CompositeField-s-children). I wonder if find* functions are similarly broken.