For up to date documentation and features, visit http://docs.sencha.com/ext-js/4-0

## Sencha Documentation

# Ext.form.FieldAncestor

A mixin for Ext.container.Container components that are likely to have form fields in their items subtree. Adds the following capabilities:

- Methods for handling the addition and removal of Ext.form.Labelable and Ext.form.field.Field instances at any depth within the container.
- Events (fieldvaliditychange and fielderrorchange) for handling changes to the state of individual fields at the container level.
- Automatic application of fieldDefaults config properties to each field added within the container, to facilitate uniform configuration of all fields.

This mixin is primarily for internal use by Ext.form.Panel and Ext.form.FieldContainer, and should not normally need to be used directly.

Defined By

### Config Options

#### Other Configs

Ext.form.FieldAncestor
view source
fieldDefaults : Object
If specified, the properties in this object are used as default config values for each Ext.form.Labelable instance (e...

If specified, the properties in this object are used as default config values for each Ext.form.Labelable instance (e.g. Ext.form.field.Base or Ext.form.FieldContainer) that is added as a descendant of this container. Corresponding values specified in an individual field's own configuration, or from the defaults config of its parent container, will take precedence. See the documentation for Ext.form.Labelable to see what config options may be specified in the `fieldDefaults`.

Example:

    new Ext.form.Panel({
        fieldDefaults: {
            labelAlign: 'left',
            labelWidth: 100
        },
        items: [{
            xtype: 'fieldset',
            defaults: {
                labelAlign: 'top'
            },
            items: [{
                name: 'field1'
            }, {
                name: 'field2'
            }]
        }, {
            xtype: 'fieldset',
            items: [{
                name: 'field3',
                labelWidth: 150
            }, {
                name: 'field4'
            }]
        }]
    });

In this example, field1 and field2 will get labelAlign:'top' (from the fieldset's `defaults`) and labelWidth:100 (from `fieldDefaults`), field3 and field4 will both get labelAlign:'left' (from `fieldDefaults` and field3 will use the labelWidth:150 from its own config.

Defined By

### Events

Ext.form.FieldAncestor
view source
fielderrorchange( Ext.form.FieldAncestor this, Ext.form.Labelable The, String error)

Fires when the active error message is changed for any one of the Ext.form.Labelable instances within this container.

Fires when the active error message is changed for any one of the Ext.form.Labelable instances within this container.

### Parameters

- this : Ext.form.FieldAncestor
- The : Ext.form.Labelable

  Labelable instance whose active error was changed

- error : String

  The active error message