Ext.define('customer', {
		extend: '',
		fields: [
			{type: 'int', name: 'id'},
			{type: 'string', name: 'company'},
			{type: 'string', name: 'vat'},
			{type: 'string', name: 'ssn'},
			{type: 'int', name: 'ref_id'}
	var required = '<span style="color:red;font-weight:bold" data-qtip="Required">*</span>';
	/*var customer_store = Ext.create('', {
							autoDestroy: true,
							model: 'customer',
							autoLoad: true,
							proxy: {
								type: 'ajax',
								url: 'load.php?item=customer',            
								reader: {
									type: 'json',
									successProperty: 'success',
									root: 'data'

    var formPanel = Ext.create('Ext.form.Panel', {
        renderTo: 'form-ct',
        frame: true,
        title:'Edit customer',
        width: 340,
        bodyPadding: 5,
        waitMsgTarget: true,

        fieldDefaults: {
            labelAlign: 'right',
            labelWidth: 85,
            msgTarget: 'side'

        reader : Ext.create('', {
            model: 'customer',
            successProperty: 'success',
			root: 'data'
		items: [{
			fieldLabel: 'company',
			name: 'company'
			afterLabelTextTpl: required
			fieldLabel: 'vat', //I.V.A.
			name: 'vat'
			afterLabelTextTpl: required
			fieldLabel: 'ssn', //fiscal code
			name: 'ssn'
			afterLabelTextTpl: required
			xtype: 'combobox',
			fieldLabel: 'reference customer',
			name: 'ref_id',
			store:  customer_store,
			valueField: 'id',		
			displayField: 'company',
			typeAhead: true,
			queryMode: 'remote',
			emptyText: 'Select a customer'

        buttons: [{
            text: 'Load selected customer',
            handler: function(){
                    url: <?php echo "'load_customer.php?id=".$_GET['id']."',"; ?>
                    waitMsg: 'Loading...'
        }/*, {
            text: 'Submit',
            disabled: true,
            formBind: true,
            handler: function(){
                    url: 'xml-form-errors.xml',
                    submitEmptyText: false,
                    waitMsg: 'Saving Data...'

Hello everyone,
I have a problem with code written above, because it doesn't work as I'd like.
That code is inspired by the example called 'Ajax with XML forms' (, when the user hits the 'Load selected customer' button a PHP script fetches a record from a MySQL database, encodes fetched data as a JSON string and then sends that string to output stream by using 'echo' instruction.
The code doesn't work as expected, because when I run it the only result I obtain is an empty form, that is a form without any fields.
I have done some debug and I'm sure that 'load_customer.php' works fine: it returns the JSON string I expect.
Any idea to fix my code ?
Thanks in advance.