diff --git a/productMods/edit/forms/addAuthorsToInformationResource.jsp b/productMods/edit/forms/addAuthorsToInformationResource.jsp index 387aea4e..89533f7c 100644 --- a/productMods/edit/forms/addAuthorsToInformationResource.jsp +++ b/productMods/edit/forms/addAuthorsToInformationResource.jsp @@ -388,7 +388,7 @@ SPARQL queries for existing values. --%>
- -
+ +
* required fields
diff --git a/productMods/edit/forms/css/customFormWithAdvanceTypeSelection.css b/productMods/edit/forms/css/customFormWithAdvanceTypeSelection.css index 5c5d481e..de2b91b0 100644 --- a/productMods/edit/forms/css/customFormWithAdvanceTypeSelection.css +++ b/productMods/edit/forms/css/customFormWithAdvanceTypeSelection.css @@ -1 +1,17 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +/* Although Javascript hides these on page load, hide here as well to avoid the flash on page load. + This needs to be removed to support a non-JS version of the form. */ +#fullViewOnly, +#submit, +.or, +#requiredLegend { + display: none; +} + +#content form p.inline label { + display: inline; + clear: none; + float: none; + margin-right: 1em; +} diff --git a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js index 29afeec0..3dda1215 100644 --- a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js +++ b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js @@ -20,14 +20,18 @@ var customFormWATS = { initObjects: function(){ this.form = $('#content form'); + this.fullViewOnly = $('#fullViewOnly'); this.button = $('#submit'); - this.or = $('span.or'); this.requiredLegend = $('#requiredLegend'); + this.typeSelector = this.form.find('#typeSelector'); + + this.or = $('span.or'); + this.cancel = this.form.find('.cancel'); + + // These are classed rather than id'd in case we want more than one autocomplete on a form. + this.acSelector = this.form.find('.acSelector'); + this.acSelection = this.form.find('.acSelection'); - this.typeSelector = this.form.find('.typeSelector'); - this.acInput = this.form.find('.acInput'); - this.acSelection = this.form.find('.acSelection'); - this.cancel = this.form.find('cancel'); }, @@ -47,30 +51,50 @@ var customFormWATS = { this.requiredLegend.hide(); this.cancel.unbind('click'); - this.cancel('click', function() { - - }); + }, initFormFullView: function() { - this.button.show(); + this.fullViewOnly.show(); this.or.show(); this.requiredLegend.show(); + this.button.show(); + this.button.val('Create Publication'); - this.cancel.unbind('click'); - this.cancel('click', function() { - + this.cancel.click(function() { + customFormWATS.initFormTypeView(); }); }, - // Bind event listeners that apply to all form views + // Bind event listeners that can persist over the life of the page. bindEventListeners: function() { + this.typeSelector.change(function() { + var labelField, + labelFieldLabel, + labelText, + selectedText; + + if ($(this).val().length) { + + // Set label for label field + labelField = $('#label'); + labelFieldLabel = $('label[for=' + labelField.attr('id') + ']'); + labelText = labelFieldLabel.html(); + selectedText = $(this).find(':selected').html(); + labelFieldLabel.html(selectedText + ' ' + labelText); + + customFormWATS.initFormFullView(); + + // set ac type + } + }); }, initAutocomplete: function() { + // ac selection: disable typeSelector and acSelector }