PDA

View Full Version : Compositefield children not submitted



spor
4 Nov 2010, 7:29 AM
I am wondering why the children in this compositefield aren't submited.


{
xtype : 'compositefield',
name : 'statusandfolderdate',
fieldLabel : globals_STATUS,
combineErros : false,
items : [{
xtype : 'folder_status',
submitValue : true,
name : 'status,
flex : 1
}, {
xtype : 'displayfield',
value : 'folderdate'
}, {
xtype : 'datefield',
submitValue : true,
name : 'date,
flex : 1
}]
}The only thing that is submitted from this compositefield is:


statusandfolderdate":""

Condor
4 Nov 2010, 7:37 AM
1. I assume your original code is actually valid javascript?

2. How are you submitting the form, e.g. getValues() will return the field values, but getFieldValues() won't.

spor
4 Nov 2010, 7:48 AM
1. I assume your original code is actually valid javascript?

2. How are you submitting the form, e.g. getValues() will return the field values, but getFieldValues() won't.


Yes, since non-composite fields before and after this compositefield are being submitted.

I do the following to submit:



saveButtonHandler : function() {
var form = this.items.items[0].getForm();
form.submit({
params: {
values: Ext.util.JSON.encode(form.getFieldValues())
},
clientValidation: true,
url: 'services/folder/save',
scope: this,
success: this.onSaveSuccess,
failure: function(response, opts){
Ext.MessageBox.alert('Error message', 'something is wrong');
}
});
},


Thanks for your quick reply, Condor.

spor
4 Nov 2010, 8:06 AM
1. I assume your original code is actually valid javascript?

2. How are you submitting the form, e.g. getValues() will return the field values, but getFieldValues() won't.

You were right on the money, Condor. I did use getFieldValues(), which apparently only works for other types of fields. getValues() works like a charm :)

Thanks a lot again, Condor!

spor
5 Nov 2010, 12:47 AM
There's one problem though, Condor. Submitting using getValues will only displayfield from a combobox that is part of a compositefield.

So the question is, how do you submit compositefields that are made up of comboboxes?

Condor
5 Nov 2010, 1:53 AM
Configure the combobox with 'hiddenName' instead of 'name'.

spor
5 Nov 2010, 4:13 AM
I replied on the wrong thread, just makes it confusing, sorry :)

qooleot
7 Dec 2010, 4:31 PM
getValues() works, but then you can't get around the whole emptyText submitting thing. Then its not easy to loop through the form fields to manually compare emptyText property with the form field's value and blank it out because compositefield doesn't work well with form.find('name', 'fieldName').

I guess it looks cool as a demo, but compositefield is going to take some work to make work. I guess I should just use hbox or wait for extjs4 when form layout is gone...