PDA

View Full Version : Empty text ExtJS 3.4 bugs



johniman
14 Jan 2013, 7:06 AM
Hi! I'm using ExtJS 3.4 and I have two problems with empty text:

1. All entered data in text fields are disappear, if this data equal empty text
2. I'm using submit form with getValues() method, and empty text values submitted with other data. I know, that text field contains option "submitEmptyText" for disable submitting empty text values, but I need to submit form with getValues() method.

Any help is appreciated.

Thanks!

mitchellsimoens
16 Jan 2013, 1:09 PM
The first thing is a bug, it wasn't designed very well really and was changed in Ext JS 4. What I usually do is prefix with 'Sample: ' so my emptyText would be emptyText : 'Sample: xxxxxx'. That gets around the bug yet still works but now that conflicts with your 2nd issue where you want the emptyText to be sent along with it.

It seems to me that your fields have a default value (the emptyText) and then you can use optional text. You would need to get the fields from the basic form, loop through that array and execute getValue. If it's falsey then use the emptyText value)

johniman
16 Jan 2013, 10:17 PM
Thank you! In the first case, I solved the problem in the same way. And for second case, I've wrote this:



this.form.items.each(function(f) {
if (f.el.getValue() == f.emptyText) {
f.el.dom.value = '';
}
})