PDA

View Full Version : How to stop submiting empty values



hudi1
3 Jun 2013, 1:04 AM
Hi,

I have form. When field is date or combo box with enum and I submit form this value is null which is what I want. Problem is when I submit empty string. Then this value isnt null. I try to add config paramater submitEmptyText : false, but result is still same. So this bug isnt still fixed ?


form.submit({
submitEmptyText : false,
scope : this,
success : function(form, action) {
this.doGridRefresh();
dialog.close();
this.buildDetails(action.result.id);
},
failure : function(form, action) {
console.log(action.result);
}

});

slemmon
4 Jun 2013, 4:15 PM
I believe the form sending an empty string is valid. If I build a standard HTML form and submit with an empty value that's what happens. But, I believe you have options. You could extend combobox and make your own implementation of combobox's getSubmitValue (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.ComboBox-method-getSubmitValue).

hudi1
4 Jun 2013, 11:00 PM
I dont argue that sending empty values is bad or good. But in my case I dont want to send them

slemmon
5 Jun 2013, 12:28 PM
Oh. Thought you were looking to report it as a bug. :)
In that case, you can extend or override combobox and supply your own getSubmitValue:



getSubmitValue: function () {
var value = this.getValue();


if (Ext.isEmpty(value)) {
value = null;
}
return value;
}