PDA

View Full Version : form action load



damien
22 Nov 2007, 11:14 AM
I have a form


var simple = new Ext.FormPanel({
labelAlign: 'left',
title: 'Vestiging',
//renderTo:'content',
bodyStyle:'padding:5px',
iconCls: 'icon-form',
frame:true,
buttonAlign :'right',
width: 600,
items:[main,tabs],
buttons: [save]
});And i try to load data into the form from a json array. So i look in the document and find action.load.


simple.addButton('Load', function(){
simple.form.load({
url:'get_handlers/get_vestiging.php',
waitMsg:'Loading',
scope:simple,
params:{"parameter":"73"}
});
});clicking the button triggers the url to load. It gives back json code:

{success: true, data:[{dealernr:"654321",bedrijfsnaam:"EBPS Software",straat:"Marseillelaan",huisnr:"18",
postcode:"5627GL",plaats:"Eindhoven",email:"[email protected]",opmerkingen:"",
nr_telefoon:"040-4012024",nr_fax:"",disabled:"0"}]}I check the result (created a succes function to view if the data is loaded). Everything seems te be working fine, except there is no data in my form??? I stays empty. Do i have to create a reader and add this to the form? I read in some toppics that this is only needed if loading xml.

tryanDLS
22 Nov 2007, 2:12 PM
Do you Field names match the property names in the returned JSON?

damien
22 Nov 2007, 2:18 PM
Yes. they have.

tryanDLS
22 Nov 2007, 3:01 PM
The data object should not be an array - remove the brackets.

damien
22 Nov 2007, 11:12 PM
Thank you. That solved the problem.