From: Simon Hieu Mai Date: Thu, 7 Mar 2013 16:21:21 +0000 (-0600) Subject: LP#1152235: Editing MARC Fixed Fields - fix blank field behavior X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fsimonmai%2Fmarc_editor_blank_field;p=working%2FEvergreen.git LP#1152235: Editing MARC Fixed Fields - fix blank field behavior When editing a field that had data in it to be blank, libs staff must fill in spaces to take up that space. Otherwise, it retains the old data (after saving record). This patch will do that job (adding those spaces). Signed-off-by: Simon Hieu Mai --- diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 1fbf544dd6..f494bf99b1 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -819,8 +819,11 @@ function updateFixedFields (element) { var new_value = element.value; // Don't take focus away/adjust the record on partial changes var length = element.getAttribute('maxlength'); - if(new_value.length < length) return true; + if ((new_value.length < length) & (new_value.length > 0)) return true; + if (new_value.length == 0){ + for (var i = 0;i < length;i++){ new_value = new_value + ' ';} + } var marc_rec = new MARC.Record ({ delimiter : '$', marcxml : xml_record.toXMLString() }); marc_rec.setFixedField(element.getAttribute('name'), new_value);