PDA

View Full Version : Struggling to save form in Ext.Direct



The_Anomaly
25 Oct 2011, 8:28 AM
Hi

Appreciate any help I can get here. I am using a borderlayout app that runs off Ext.Direct. So far its mostly grids and pre filter pages. Some forms are staring to pop up now as requirements have changed. Still wanting to use Direct for my forms I have done so. However after much struggle I can't seem to get the form to save, even after following the guides online and in the examples (bear with me I'm a noob). A portion of my code is below:


items: [{ xtype: 'panel',
title: 'Retailer Settings',
layout: 'accordion',
id: 'retailerDetails',
items: [{
xtype: 'form',
title: 'Retailer Details',
id: 'generalDetails',
autoScroll: true,
paramOrder: ['rid'],
autoSave: true,
api: {
load: Retailer.getRetailer,
submit: Retailer.saveRetailer
},
items: [{
xtype: 'fieldset',
autoHeight: true,
title: 'Geographic Information',
items: [cbo_country, provincecombo, cbo_city],
collapsible: true
}, {
xtype: 'fieldset',
autoHeight: true,
title: 'Retailer Info',


items: [cbo_chain, cbo_channel,
{
xtype: 'textfield',
fieldLabel: 'Retailer Name',
name: 'retailername',
id: 'retailername',
width: 184
}, {
xtype: 'textfield',
fieldLabel: 'Outlet Code',
name: 'retailercode',
width: 184
}, {
xtype: 'textfield',
name: 'managername',
fieldLabel: 'Manager',
width: 184
}, {
xtype: 'textfield',
fieldLabel: 'Telephone',
name: 'telnum',
width: 184
}, {
xtype: 'textarea',
fieldLabel: 'Address',
name: 'address',
id: 'address',
height: 90,
width: 184
}],
collapsible: true
}, {
xtype: 'fieldset',
autoHeight: true,
title: 'Map',
collapsible: true,
items: [{
xtype: 'button',
iconAlign: 'left',
iconCls: 'silk-map',
text: 'Google Map',
id: 'google-map'
}]
}],
padding: 10,
tbar: new Ext.Toolbar({
items: [{
text: 'Apply Changes',
iconCls: 'silk-table_save',
waitMsg: 'Saving…',
handler: function () {
generalRetailerDetails.getForm().submit({
params: {
rid: 48
}
});
}
}]
})


}]
}],
activeTab: 0

You can see the Api there for loading and the submit. But when the apply button is triggered the returned data is:

{"type":"rpc","tid":8,"action":"Retailer","method":"saveRetailer","result":{"success":true,"data":[{}],"update retailer sql":{"sql":"UPDATE tblretailer set countryid = , provinceid = , cityid = , managername = \"\"\r\n\t\tWHERE retailerid = ;"},"data sent":{"data":{}}}}
As you can see I have included the data being passed in the return so that I can debug the code. It's BLANK! Does anyone have suggestions for me? Where could I be going wrong?

The_Anomaly
30 Oct 2011, 10:34 AM
bump...

I've used these forums so many times for assistance. I can't believe there's no one out there that can tell me where I've gone wrong. Is this an EXT.Direct bug maybe? Should I paste the entire pages code instead of just the tabs? I could really do with the help. :((

Are there any examples out there of forms using ext.direct? Any help would be great.

The_Anomaly
1 Nov 2011, 12:59 PM
This is solved. Wrote the whole thing from ground up using the samples only to discover I originally left out this line:


'formHandler'=>true

in the api_config.php Should have been obvious but up till now I haven't made any forms. ;)