diff --git a/productMods/edit/forms/addGrantRoleToPerson.jsp b/productMods/edit/forms/addGrantRoleToPerson.jsp
index 3ff805ac..adf891c9 100644
--- a/productMods/edit/forms/addGrantRoleToPerson.jsp
+++ b/productMods/edit/forms/addGrantRoleToPerson.jsp
@@ -89,9 +89,9 @@ if ( ((String)request.getAttribute("predicateUri")).endsWith("hasPrincipalInvest
?grant rdfs:label ?grantLabel .
-<%-- Must be all one line for JavaScript. Must use ?individual since Javascript will look for that property in the data returned. --%>
+<%-- Must be all one line for JavaScript. --%>
-PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:hasPrincipalInvestigatorRole ?grantRole .?grantRole core:relatedRole ?individual .}
+PREFIX core: <${vivoCore}> SELECT ?grantUri WHERE {<${subjectUri}> core:hasPrincipalInvestigatorRole ?grantRole .?grantRole core:relatedRole ?grantUri .}
${vivoOnt}#Grant
diff --git a/productMods/edit/forms/addPublicationToAuthor.jsp b/productMods/edit/forms/addPublicationToAuthor.jsp
index d643b9ce..2600911e 100644
--- a/productMods/edit/forms/addPublicationToAuthor.jsp
+++ b/productMods/edit/forms/addPublicationToAuthor.jsp
@@ -102,9 +102,9 @@ SPARQL queries for existing values. --%>
?pubUri core:informationResourceInAuthorship ?authorshipUri .
-<%-- Must be all one line for JavaScript. Must use ?individual since Javascript will look for that property in the data returned. --%>
+<%-- Must be all one line for JavaScript. --%>
-PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:authorInAuthorship ?authorshipUri .?authorshipUri core:linkedInformationResource ?individual .}
+PREFIX core: <${vivoCore}> SELECT ?pubUri WHERE {<${subjectUri}> core:authorInAuthorship ?authorshipUri .?authorshipUri core:linkedInformationResource ?pubUri .}
diff --git a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js
index f4b0092a..5eb4cb4f 100644
--- a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js
+++ b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js
@@ -89,9 +89,10 @@ var customForm = {
this.requiredLegend.show();
this.button.show();
this.button.val('Create ' + this.baseButtonText);
-
+ this.cancel.unbind('click');
+
if( this.formSteps > 1 ){
- this.cancel.unbind('click');
+
this.cancel.click(function() {
customForm.clearFormData(); // clear any input and validation errors
customForm.initFormTypeView();
@@ -184,9 +185,10 @@ var customForm = {
},
setAcFilter: function(data) {
- var filter = [];
+ var filter = [],
+ key = data.head.vars[0];
$.each(data.results.bindings, function() {
- filter.push(this.individual.value);
+ filter.push(this[key].value);
});
this.acFilter = filter;
},
@@ -237,18 +239,31 @@ var customForm = {
this.acSelectionInfo.html(ui.item.label);
this.verifyMatch.attr('href', this.verifyMatchBaseHref + uri);
- this.button.val('Add ' + this.baseButtonText);
-
- if( this.formSteps > 1){
- this.cancel.unbind('click');
- this.cancel.click(function() {
- // TODO Check out cancel action for authors form. Need to undo/empty some of the stuff above.
- //do we do it in the initfullview method, or here?
- customForm.initFormFullView();
- return false;
- });
- }
+ this.button.val('Add ' + this.baseButtonText);
+ this.cancel.unbind('click');
+ this.cancel.click(function() {
+ customForm.undoAutocompleteSelection();
+ customForm.initFormFullView();
+ return false;
+ });
+ },
+
+ // Cancel action after making an autocomplete selection: undo autocomplete
+ // selection (from showAutocomplete) before returning to full view.
+ undoAutocompleteSelection: function() {
+
+ this.acSelectorWrapper.show();
+ this.hideFields(this.acSelection);
+ this.acReceiver.val('');
+ this.acSelectionInfo.html('');
+ this.verifyMatch.attr('href', this.verifyMatchBaseHref);
+ this.button.val('Create ' + this.baseButtonText)
+
+ if (this.formSteps > 1) {
+ this.acSelection.find('label').html('Selected ');
+ }
+
},
getSelectedTypeName: function() {