From: Bill Erickson Date: Fri, 20 Jul 2012 15:15:25 +0000 (-0400) Subject: EditPane.js API repairs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=85738dad271fd5449e3765ad682905c45e942641;p=evergreen%2Fequinox.git EditPane.js API repairs By default, don't throw an exception from EditPane.getFieldValue when a field is required and the value is null. Otherwise, external code is unable to use this method for inspecting the pane. Make checkRequired an additional method flag. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/dojo/openils/widget/EditPane.js b/Open-ILS/web/js/dojo/openils/widget/EditPane.js index d7c54b8375..887015dacd 100644 --- a/Open-ILS/web/js/dojo/openils/widget/EditPane.js +++ b/Open-ILS/web/js/dojo/openils/widget/EditPane.js @@ -222,15 +222,17 @@ if(!dojo._hasResource['openils.widget.EditPane']) { } }, - getFieldValue : function(field) { + getFieldValue : function(field, checkRequired) { for(var i in this.fieldList) { if(field == this.fieldList[i].name) { var val = this.fieldList[i].widget.getFormattedValue(); - if (val == null && /* XXX stricter check needed? */ + if (checkRequired && + val == null && /* XXX stricter check needed? */ this.fieldList[i].widget.isRequired()) { throw new Error("req"); } return val; + } } }, @@ -253,7 +255,7 @@ if(!dojo._hasResource['openils.widget.EditPane']) { try { for(var idx in fields) { this.fmObject[fields[idx]]( - this.getFieldValue(fields[idx]) + this.getFieldValue(fields[idx], true) ); } } catch (E) {