clear errors on reset

https://fedorahosted.org/freeipa/ticket/1446
This commit is contained in:
Adam Young 2011-07-08 10:15:16 -04:00 committed by Endi S. Dewata
parent 2337fb5760
commit 30492ef3fa
3 changed files with 10 additions and 4 deletions

View File

@ -155,7 +155,6 @@ IPA.details_section = function(spec) {
for (var j=0; j<fields.length; j++) { for (var j=0; j<fields.length; j++) {
var field = fields[j]; var field = fields[j];
var span = $('span[name='+field.name+']', this.container).first();
field.load(record); field.load(record);
} }
}; };
@ -164,7 +163,6 @@ IPA.details_section = function(spec) {
var fields = that.fields.values; var fields = that.fields.values;
for (var i=0; i<fields.length; i++) { for (var i=0; i<fields.length; i++) {
var field = fields[i]; var field = fields[i];
var span = $('span[name='+field.name+']', this.container).first();
field.reset(); field.reset();
} }
}; };

View File

@ -170,7 +170,7 @@ test("Testing details lifecycle: create, setup, load.", function(){
widget.save = function() { widget.save = function() {
save_called = true; save_called = true;
widget.widget_save(); return widget.widget_save();
}; };
return widget; return widget;
} }

View File

@ -140,6 +140,12 @@ IPA.widget = function(spec) {
that.valid = true; that.valid = true;
var values = that.save(); var values = that.save();
if (!values){
return;
}
if (values.length ===0 ){
return;
}
var value = values[0]; var value = values[0];
if (!value) { if (!value) {
return; return;
@ -264,6 +270,7 @@ IPA.widget = function(spec) {
that.reset = function() { that.reset = function() {
that.update(); that.update();
that.validate();
that.set_dirty(false); that.set_dirty(false);
}; };
@ -1704,11 +1711,12 @@ IPA.entity_select_widget = function(spec) {
that.reset = function() { that.reset = function() {
that.entity_filter.val(that.values[0]); that.entity_filter.val(that.values[0]);
that.set_dirty(false);
populate_select(that.values[0]); populate_select(that.values[0]);
if (editable){ if (editable){
that.edit_box.val(that.values[0]); that.edit_box.val(that.values[0]);
} }
that.validate();
that.set_dirty(false);
}; };
that.load = function(record) { that.load = function(record) {