diff --git a/productMods/edit/forms/addGrantRoleToPerson.jsp b/productMods/edit/forms/addGrantRoleToPerson.jsp index 25ab5c27..b55a2b99 100644 --- a/productMods/edit/forms/addGrantRoleToPerson.jsp +++ b/productMods/edit/forms/addGrantRoleToPerson.jsp @@ -286,7 +286,7 @@ PREFIX core: <${vivoCore}> <%-- DO NOT CHANGE IDS, CLASSES, OR HTML STRUCTURE IN THIS FORM WITHOUT UNDERSTANDING THE IMPACT ON THE JAVASCRIPT! --%>
" > -

+

<%-- Store this value in a hidden field, because the displayed field is disabled and don't submit. This ensures that when returning from a validation error, we retain the value. --%> diff --git a/productMods/edit/forms/addRoleToPersonTwoStage.jsp b/productMods/edit/forms/addRoleToPersonTwoStage.jsp index d60b7d78..b7d36252 100644 --- a/productMods/edit/forms/addRoleToPersonTwoStage.jsp +++ b/productMods/edit/forms/addRoleToPersonTwoStage.jsp @@ -394,7 +394,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
-

+

<%-- Store these values in hidden fields, because the displayed fields are disabled and don't submit. This ensures that when returning from a validation error, we retain the values. --%> @@ -409,14 +409,14 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
-

+

-

Years of Participation in

+

Years of Participation in ###

diff --git a/productMods/edit/forms/js/customFormWithAutocomplete.js b/productMods/edit/forms/js/customFormWithAutocomplete.js index 58d47e67..f422452c 100644 --- a/productMods/edit/forms/js/customFormWithAutocomplete.js +++ b/productMods/edit/forms/js/customFormWithAutocomplete.js @@ -58,25 +58,8 @@ var customForm = { this.verifyMatchBaseHref = this.verifyMatch.attr('href'); this.acSelectorWrapper = this.acSelector.parent(); - this.relatedIndLabel = $('#relatedIndLabel'); - this.labelFieldLabel = $('label[for=' + this.relatedIndLabel.attr('id') + ']'); - // Get this on page load, so we can prepend to it. We can't just prepend to the current label text, - // because it may have already been modified for a previous selection. - this.baseLabelText = this.labelFieldLabel.html(); - - // Label field for new individual being created - this.newIndLabel = $('#newIndLabel'); - this.newIndLabelFieldLabel = $('label[for=' + this.newIndLabel.attr('id') + ']'); - this.newIndBaseLabelText = this.newIndLabelFieldLabel.html(); - - this.dateHeader = $('#dateHeader'); - this.baseDateHeaderText = this.dateHeader.html(); - this.or = $('span.or'); this.cancel = this.form.find('.cancel'); - - this.placeHolderText = '###'; - }, // Set up the form on page load @@ -87,7 +70,7 @@ var customForm = { } if (!this.formSteps) { // Don't override formSteps specified in form data - if (!this.typeSelector.length || !this.fullViewOnly.length || this.editMode === 'edit' || this.editMode === 'repair') { + if ( !this.fullViewOnly.length || this.editMode === 'edit' || this.editMode === 'repair' ) { this.formSteps = 1; // there may also be a 3-step form - look for this.subTypeSelector } @@ -100,6 +83,8 @@ var customForm = { this.initAutocomplete(); + this.initPlaceholderData(); + this.initFormView(); }, @@ -252,6 +237,17 @@ var customForm = { }); }, + initPlaceholderData: function() { + this.placeholderText = '###'; + this.labelsWithPlaceholders = this.form.find('label, .label').filter(function() { + return $(this).html().match(customForm.placeholderText); + }); + + this.labelsWithPlaceholders.each(function(){ + $(this).data('originalLabel', $(this).html()); + }); + }, + getAcFilter: function() { if (!this.sparqlForAcFilter) { @@ -391,20 +387,12 @@ var customForm = { // Set field labels based on type selection. Although these won't change in edit // mode, it's easier to specify the text here than in the jsp. setLabels: function() { - var newLabelTextForNewInd, - typeText = this.getTypeNameForLabels(); - - - this.labelFieldLabel.html(typeText + ' ' + this.baseLabelText); - - if (this.dateHeader.length) { - this.dateHeader.html(this.baseDateHeaderText + typeText); - } - - if (this.newIndLabel.length) { - newLabelTextForNewInd = this.newIndBaseLabelText.replace(this.placeHolderText, typeText); - this.newIndLabelFieldLabel.html(newLabelTextForNewInd); - } + var typeName = this.getTypeNameForLabels(); + + this.labelsWithPlaceholders.each(function() { + var newLabel = $(this).data('originalLabel').replace(customForm.placeholderText, typeName); + $(this).html(newLabel); + }); }, diff --git a/productMods/edit/forms/personHasEducationalTraining.jsp b/productMods/edit/forms/personHasEducationalTraining.jsp index 5234d19a..7ea58fe7 100644 --- a/productMods/edit/forms/personHasEducationalTraining.jsp +++ b/productMods/edit/forms/personHasEducationalTraining.jsp @@ -395,7 +395,7 @@ core:dateTimePrecision (DateTimeValue : DateTimeValuePrecision)

-

+

<%-- Store these values in hidden fields, because the displayed fields are disabled and don't submit. This ensures that when returning from a validation error, we retain the values. --%> @@ -410,7 +410,7 @@ core:dateTimePrecision (DateTimeValue : DateTimeValuePrecision) - +

e.g., Postdoctoral training or Transferred

diff --git a/productMods/edit/forms/personHasPositionHistory.jsp b/productMods/edit/forms/personHasPositionHistory.jsp index 84f9e20a..a2492ebb 100644 --- a/productMods/edit/forms/personHasPositionHistory.jsp +++ b/productMods/edit/forms/personHasPositionHistory.jsp @@ -320,7 +320,7 @@
<%--

needed to create wrapper for show/hide --%> -

+

<%-- Store these values in hidden fields, because the displayed fields are disabled and don't submit. This ensures that when returning from a validation error, we retain the values. --%> @@ -335,7 +335,7 @@
- +