* required fields
diff --git a/productMods/edit/forms/js/addAuthorsToInformationResource.js b/productMods/edit/forms/js/addAuthorsToInformationResource.js index a1f5444c..95d2ca4b 100644 --- a/productMods/edit/forms/js/addAuthorsToInformationResource.js +++ b/productMods/edit/forms/js/addAuthorsToInformationResource.js @@ -23,7 +23,15 @@ var addAuthorForm = { this.showFormDiv = $('#showAddForm'); this.showFormButton = $('#showAddFormButton'); this.removeLinks = $('a.remove'); + this.submit = this.form.find(':submit'); this.cancel = this.form.find('.cancel'); + this.labelField = $('#label'); + this.firstNameField = $('#firstName'); + this.middleNameField = $('#middleName'); + this.lastNameField = $('#lastName'); + this.personUriField = $('#personUri'); + this.firstNameWrapper = this.firstNameField.parent(); + this.middleNameWrapper = this.middleNameField.parent(); }, // On page load, make changes to the non-Javascript version for the Javascript version. @@ -38,20 +46,28 @@ var addAuthorForm = { }, initForm: function() { - + + //this.firstNameWrapper.hide(); + //this.middleNameWrapper.hide(); + this.showFormButton.click(function() { addAuthorForm.showFormDiv.hide(); addAuthorForm.form.show(); return false; }); + this.submit.click(function() { + addAuthorForm.insertLabel(); // might be insertLabelOrPersonUri + }); + this.cancel.click(function() { addAuthorForm.hideFields(addAuthorForm.form); addAuthorForm.showFormDiv.show(); return false; }); + +// this.setUpAutocomplete(); - //this.setUpAutocomplete(); }, // setUpAutocomplete: function() { @@ -63,6 +79,32 @@ var addAuthorForm = { // // }, + insertLabel: function() { + var firstName, + middleName, + lastName, + name; + + if (!this.firstNameField.is(':hidden')) { + firstName = this.firstNameField.val(); + middleName = this.middleNameField.val(); + lastName = this.lastNameField.val(); + + name = lastName; + if (firstName) { + name += ", " + firstName; + } + if (middleName) { + name += " " + middleName; + } + + this.labelField.val(name); + } + else { + + } + }, + toggleRemoveLink: function() { // when clicking remove: remove the author, and change link text to "undo" // when clicking undo: add the author back, and change link text to "remove" diff --git a/productMods/edit/forms/organizationHasPositionHistory.jsp b/productMods/edit/forms/organizationHasPositionHistory.jsp index 14d35ee2..4dcf94e3 100644 --- a/productMods/edit/forms/organizationHasPositionHistory.jsp +++ b/productMods/edit/forms/organizationHasPositionHistory.jsp @@ -198,7 +198,7 @@* required fields
diff --git a/productMods/edit/forms/personHasEducationalBackground.jsp b/productMods/edit/forms/personHasEducationalBackground.jsp index b69ae887..26bb4aa4 100644 --- a/productMods/edit/forms/personHasEducationalBackground.jsp +++ b/productMods/edit/forms/personHasEducationalBackground.jsp @@ -421,7 +421,7 @@ the org type still gets asserted. --%> -* required fields
diff --git a/productMods/edit/forms/personHasPositionHistory.jsp b/productMods/edit/forms/personHasPositionHistory.jsp index d90243a5..589ff89d 100644 --- a/productMods/edit/forms/personHasPositionHistory.jsp +++ b/productMods/edit/forms/personHasPositionHistory.jsp @@ -350,7 +350,7 @@ -* required fields