How to dynamically add a hidden field to a form in Sencha Ext JS 4

This code shows how to dynamically add a hidden field to a form with Sencha ExtJS 4:

createHiddenField: function(projectName) {
    return Ext.form.Field({
        xtype: 'hiddenfield',
        name: 'projectId',
        value: this.getProjectId(projectName)
        // autoCreate : {type: 'hidden', id: 'partID', name: 'partID', value:'', width: 0}
    });
}

I saw the autoCreate code on a Sencha forum, but that doesn't seem to be necessary; the code works as shown.