Maybe rename emptyText to defaultValue since thats what it seems its intended use is and would be less confusing. Then also add helpText parameter which would never be submitted?
Printable View
Maybe rename emptyText to defaultValue since thats what it seems its intended use is and would be less confusing. Then also add helpText parameter which would never be submitted?
I had the same problem as other users in this thread, and find it a little unlogical that the getValue() function of a field returns '' if the field is empty and emptyText is set, but when you submit the form with form.submit() the emptyText values are submitted.
I'm using the following solution, which I think is a little cleaner, as you don't have to put it directly in the Ext source, but can include from somewhere else. Another thing is that if errors are returned from server side, the emptyText values will be put back on the fields.
HTML Code:Ext.form.Action.Submit.prototype.run = Ext.form.Action.Submit.prototype.run.createInterceptor(function() {
this.form.items.each(function(item) {
if (item.el.getValue() == item.emptyText) {
item.el.dom.value = '';
}
});
});
Ext.form.Action.Submit.prototype.run = Ext.form.Action.Submit.prototype.run.createSequence(function() {
this.form.items.each(function(item) {
if (item.el.getValue() == '' && item.emptyText) {
item.el.dom.value = item.emptyText;
}
});
});
THX, That's good:D
My solution:
Code:Ext.onReady(function() {
Ext.select("form").on('submit', function() {
Ext.each(Ext.ComponentMgr.all.items, function() {
if (typeof this.getValue == "undefined" || typeof this.el == "undefined") return;
if (this.getRawValue() != this.el.getValue())
this.setRawValue("");
});
});
});
Broady, this solution did not work for me.
and sebsei where to add lines if i don't have any html file, i have a .jsp