PDA

View Full Version : BasicForm.load



bhomass
24 Oct 2007, 3:35 PM
shouldn't the follow code load myform?

var stateCombo = new Ext.form.ComboBox( {
fieldLabel : 'State',
hiddenName : 'state',
store : new Ext.data.SimpleStore( {
fields : ['abbr', 'state'],
data : Ext.exampledata.states
}),
valueField : 'abbr',
displayField : 'state',
typeAhead : true,
mode : 'local',
triggerAction : 'all',
emptyText : 'Select a state...',
selectOnFocus : true
//width : 190
})

var dobDate = new Ext.form.DateField( {
fieldLabel : 'Date of Birth',
name : 'dob',
//width : 190,
allowBlank : false
})
var emailText = new Ext.form.TextField( {
allowBlank : false,
fieldLabel : 'Email',
name : 'email',
vtype : 'email',
width : 190
})

var myform = new Ext.form.BasicForm(
'hello-form',
{}
// labelAlign: 'right',
// url:'/localhost:8080/extjs-examples/submit'

);

myform.add(
stateCombo,
emailText,
dobDate
);
myform.load({url:'http://localhost:8080/extjs-examples/ajax'});

the POST was completed, the returned data look good, but form elements are not loaded.

tryanDLS
24 Oct 2007, 4:04 PM
Please post your code in CODE tags. What does the response string look like? Set a BP in Action.processResponse and see what's happening with you server response.

bhomass
24 Oct 2007, 4:12 PM
the response text is
<code>
{'Records': [

{'email': '[email protected]',

'dob': '09/08/68',

'state': 'CA'

}]
</code>

this does raise the question, where am I suppose to declare the root: label? usu in the reader def, but here I am using the form's default JsonReader. Is this response text correct for that?

bhomass
24 Oct 2007, 6:19 PM
ok, I found it in Action.load documentation.