From 07ba14c420cfda48dc550cf0888fd96d29603e76 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 20 Jul 2012 11:15:25 -0400 Subject: [PATCH] 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 Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/web/js/dojo/openils/widget/EditPane.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) { -- 2.11.0