Search code examples
extjsextjs3

ExtJS - Issues using getForm()


Nowadays I get this form using extjs 3.4:

config = Ext.apply({
    title: 'Fluxo de Reincidencia',
    id: 'formKMLRcd',
    name: 'formKMLRcd',
    border: true,
    bodyStyle: "padding: 10px",
    layout: "form",
    autoScroll: false,
    items: [{
        xtype: "datefield",
        ref: "../extent",
        anchor: "100%",
        fieldLabel: 'Data Inicio',
        emptyText: 'informe a data de inicio',
        name: 'txtRcdDataInicio',
        id: 'txtRcdDataInicio',
        format: 'd/m/Y',
        altFormats: 'd/m/Y',
        allowBlank: false,
        validator: function (value) {
            var date = this.parseDate(this.getValue());
            if (!date) {
                return 'Informe uma data valida';
            }
        }
    }

How can I get the form object, I tried using this expression but without sucess.

var form = Ext.getCmp('formKMLRcd').getForm();

Thanks!


Solution

  • You are using Ext.apply wrong, you must specify as the first parameter the objecton which you want to apply the specified config (in your case, the panel)