From 762a32045e6f30edb5e738f167a5c53dbc60168f Mon Sep 17 00:00:00 2001 From: rjy7 Date: Fri, 3 Sep 2010 19:08:33 +0000 Subject: [PATCH] NIHVIVO-1024 Custom form Javascript bug fixes --- .../edit/forms/js/customFormWithAutocomplete.js | 16 +++++++++++----- .../edit/forms/personHasEducationalTraining.jsp | 9 ++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/productMods/edit/forms/js/customFormWithAutocomplete.js b/productMods/edit/forms/js/customFormWithAutocomplete.js index f422452c..b3c7adc3 100644 --- a/productMods/edit/forms/js/customFormWithAutocomplete.js +++ b/productMods/edit/forms/js/customFormWithAutocomplete.js @@ -145,7 +145,12 @@ var customForm = { // autocomplete type can be determined. If a type selection has been made, // unhide the acSelector field. } else if (this.typeSelector.length) { - this.typeSelector.val() ? this.acSelectorWrapper.show() : this.acSelectorWrapper.hide(); + if (this.typeSelector.val()) { + this.acSelectorWrapper.show() + } + else { + this.acSelectorWrapper.hide(); + } } }, @@ -183,8 +188,8 @@ var customForm = { customForm.undoAutocompleteSelection(); // If no selection, go back to type view. This prevents problems like trying to run autocomplete - // or submitting form without a type selection. Exception: if formSteps == 1 (e.g., a one-step form, - // or a two-step form in repair editMode) stay in full view, else we lose the role information. + // or submitting form without a type selection. Exceptions: (1) a one-step form; (2) a two-step + // form in repair mode, so we don't lose the other data in the form. (typeVal.length || customForm.formSteps === 1) ? customForm.initFormFullView() : customForm.initFormTypeView(); }); @@ -321,8 +326,9 @@ var customForm = { this.acSelectorWrapper.hide(); //this.acSelector.attr('disabled', 'disabled'); - // If only one form step, type is pre-selected, and the label is coded in the html. - if (this.formSteps > 1) { + // If form has a type selector, add type name to label. If form has no type selector, + // type name is coded into the html. + if (this.typeSelector.length) { this.acSelection.find('label').html('Selected ' + this.typeName + ':'); } diff --git a/productMods/edit/forms/personHasEducationalTraining.jsp b/productMods/edit/forms/personHasEducationalTraining.jsp index 7ea58fe7..7662cb29 100644 --- a/productMods/edit/forms/personHasEducationalTraining.jsp +++ b/productMods/edit/forms/personHasEducationalTraining.jsp @@ -207,10 +207,9 @@ core:dateTimePrecision (DateTimeValue : DateTimeValuePrecision) "predicate" : ["predicate", "${predicateUriJson}" ], "object" : ["edTraining", "${objectUriJson}", "URI" ], - "n3required" : [ "${n3ForNewEdTraining}", "${majorFieldAssertion}" ], + "n3required" : [ "${n3ForNewEdTraining}", "${majorFieldAssertion}", "${orgLabelAssertion}", "${orgTypeAssertion}" ], - "n3optional" : [ "${n3ForEdTrainingToOrg}", - "${orgLabelAssertion}", "${orgTypeAssertion}", + "n3optional" : [ "${n3ForEdTrainingToOrg}", "${degreeAssertion}", "${deptAssertion}", "${infoAssertion}", "${yearAssertion}" ], "newResources" : { "edTraining" : "${defaultNamespace}", @@ -282,7 +281,7 @@ core:dateTimePrecision (DateTimeValue : DateTimeValuePrecision) }, "orgLabel" : { "newResource" : "false", - "validators" : [ ], + "validators" : [ "nonempty" ], "optionsType" : "UNDEFINED", "literalOptions" : [ ], "predicateUri" : "", @@ -293,7 +292,7 @@ core:dateTimePrecision (DateTimeValue : DateTimeValuePrecision) }, "orgType" : { "newResource" : "false", - "validators" : [ ], + "validators" : [ "nonempty" ], "optionsType" : "CHILD_VCLASSES", "literalOptions" : [ "Select one" ], "predicateUri" : "",