PDA

View Full Version : EmptyText Submission



SabaSarwat
14 Dec 2010, 12:05 AM
Hello everyone,

I have a form, Its items have emptyTexts. When i submit this form, empty Text submits as a value;
like first_name : 'Enter First Name', i want it to be submitted like first_name : ''
I searched the forum but could not find any appropriate solution,
Hoping to get the response soon...

Regards...

arthurakay
14 Dec 2010, 5:57 PM
The API docs state:

emptyText: The default text to place into an empty field (defaults to null). Note: that this value will be submitted to the server if this field is enabled and configured with a name.

So, if your fields have "name" defined you will need a way around this.

One way is to not use the standard submit - create an Ext.Ajax.request() call when the user hits "submit" and manually define your values.

There are other workarounds, but I don't know exactly what you're working with. Post some code and we'll find a good solution.

SabaSarwat
15 Dec 2010, 6:36 AM
I have too many fieldsets with lots of form components, to give their description i used emptyText. Now when i am submitting my fields, emptyText is submitting as well, which of course i don't want.
The code for submit is given :



currentForm.getForm().submit({
method:'POST',
waitTitle: 'Wait',
waitMsg: 'Saving...',

success:function(frm, action){
Ext.MessageBox.show({
title: 'User Setting',
msg: 'User Settings are successfully saved!'
});
},

failure:function(form, action){
if(action.failureType == 'server'){
Ext.MessageBox.show({
title: 'Update Application Setting Failure',
msg: 'Data cannot be saved. Please try again!!!',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
}else{
Ext.Msg.alert('Warning!', 'Server is unreachable');
}
}});