EmptyText is submitted with the form

I am using Ext Js 3.4. I ran into a problem while using myform.getForm.getValues()

emptytext also sent in the request.

Below are the code snippets

 myForm = new Ext.FormPanel({ id: 'myForm ', items: [ { region:'center', border:false, items:[center_one] },{ region:'west', border:false, items :[west_one] },{ region:'east', border:false, items :[east_one] },{ region:'south', layout:'table', iborder:false, items: [south_one] } ] }); var west_one= new Ext.form.FieldSet({ width: 282, height:250, layout: 'table', items: [{ id: 'form1', layout: 'form', items: [field1] },{ id: 'form2', layout: 'form', items: [field2] }] }); var field1 = new Ext.form.ComboBox({ fieldLabel: 'Field', width: 150, name: 'field1', cls: 'fields field1', id: 'field1', store: field1Store, displayField: 'name', valueField: 'name', mode: 'local', emptyText: 'Select Field1', // This value gets submiited when no value is selected selectOnFocus: true, triggerAction: 'all', forceSelection : true, editable:true, typeAhead:true, }); 

And this is how I post:

 Ext.Ajax.request({ url: 'forms.do?submit', method: 'POST', params: myForm.getForm().getValues(), success: function(response, option){ }, failure: function(){ } }); 
+8
javascript extjs extjs3
source share
2 answers

You will need to add this configuration to formform xtype:

 submitEmptyText: false 

By default, defalut submitEmptyText is true. Check it out in the online documentation HERE .

EDIT: try using the following code instead of Ext.ajax:

 var myForm = Ext.getCmp('myForm').getForm(); myForm.submit({ url : 'forms.do?submit', method : 'POST', fileUpload : true, submitEmptyText : false, // waitMsg : 'Saving data', success : function(form, action) {} }); 
+19
source share

If you just want to get values โ€‹โ€‹without emptytext (for example, to send them using Ext.Ajax , as in your question), use myForm.getForm().getFieldValues() .

+1
source share

All Articles