From 405d77d324ec741704d4e99d3e264e3d16e020b2 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 --- 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 1fd41adb75..ee4a9395ee 100644 --- a/Open-ILS/web/js/dojo/openils/widget/EditPane.js +++ b/Open-ILS/web/js/dojo/openils/widget/EditPane.js @@ -206,15 +206,17 @@ if(!dojo._hasResource['openils.widget.EditPane']) { return this.fieldList.map(function(a) { return a.name }); }, - 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; + } } }, @@ -237,7 +239,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