Search code examples
javascriptextjsextjs7

Unrecognized alias: widget.form on ExtJS 7


Im trying to use the standard form class in my new app but I get an error message

Uncaught Error: [Ext.createByAlias] Unrecognized alias: widget.form

I already imported the required library. Here is my code:

Ext.define('Xx.view.login.Login', {
    extend: 'Ext.window.Window',

    requires: [
        'Ext.form.Panel', 
        'Xx.view.login.LoginController',
        'Xx.view.login.LoginModel',
        'Ext.Button',
        'Ext.field.Text',
        'Ext.field.ComboBox'
    ],

    viewModel: 'login',
    controller: 'login',

    bodyPadding: 10,
    title: 'Login',
    closable: false,

    cls: 'login',

    items: [{
        xtype: 'form', 
        items: [{
            xtype: 'textfield',
            name: 'username',
            bind: '{username}',
            fieldLabel: 'Username',
            allowBlank: false,
            enableKeyEvents: true,
            listeners: {
                specialKey: 'onSpecialKey'
            }
        },

When I change the code from

xtype: 'form'

to

xtype: 'panel'

the UI renders. Thank you in advance


Solution

  • I guess you use modern toolkit. In modern toolkit the alias for Ext.form.Panel class is formpanel, see here. On the other hand side in classic toolkit the alias is indeed form, see here.

    The alias panel exists in both modern and classic, in classic it stands for Ext.panel.Panel, in modern for Ext.Panel.