diff --git a/productMods/edit/forms/js/customFormWithAutocomplete.js b/productMods/edit/forms/js/customFormWithAutocomplete.js index 8ee7ef2c..936c86cc 100644 --- a/productMods/edit/forms/js/customFormWithAutocomplete.js +++ b/productMods/edit/forms/js/customFormWithAutocomplete.js @@ -179,6 +179,8 @@ var customForm = { this.initFormWithValidationErrors(); //Hide verify match when edit mode this.verifyMatch.hide(); + //Disable submit button until selection made + this.button.attr('disabled', true); }, // Bind event listeners that persist over the life of the page. Event listeners @@ -369,6 +371,10 @@ var customForm = { if(this.editMode == 'edit' && this.supportEdit) { this.verifyMatch.show(); } + if(this.supportEdit) { + //On initialization in this mode, submit button is disabled + this.button.removeAttr('disabled'); + } this.setButtonText('existing'); this.cancel.unbind('click'); @@ -398,6 +404,12 @@ var customForm = { if (this.formSteps > 1) { this.acSelection.find('label').html('Selected '); } + + //Resetting so disable submit button again for object property autocomplete + if(this.supportEdit) { + this.button.attr('disabled', true); + } + } }, @@ -491,7 +503,12 @@ var customForm = { // First case applies on page load; second case applies when the type gets changed. if (!this.acSelector.val() || this.acSelector.hasClass(this.acHelpTextClass)) { typeText = this.getTypeNameForLabels(); - this.acSelector.val("Select an existing " + typeText + " or create a new one.") + var helpText = "Select an existing " + typeText + " or create a new one."; + //Different for object property autocomplete + if(this.supportEdit) { + helpText = "Select an existing " + typeText; + } + this.acSelector.val(helpText) .addClass(this.acHelpTextClass); } }, diff --git a/productMods/templates/freemarker/edit/forms/autoCompleteObjectPropForm.ftl b/productMods/templates/freemarker/edit/forms/autoCompleteObjectPropForm.ftl index 4ee228ec..04193f4b 100644 --- a/productMods/templates/freemarker/edit/forms/autoCompleteObjectPropForm.ftl +++ b/productMods/templates/freemarker/edit/forms/autoCompleteObjectPropForm.ftl @@ -9,6 +9,10 @@ <#assign objectTypes = editConfiguration.pageData.objectTypes /> <#assign sparqlForAcFilter = editConfiguration.pageData.sparqlForAcFilter /> <#assign editMode = editConfiguration.pageData.editMode /> +<#assign propertyNameForDisplay = "" /> +<#if editConfiguration.objectPropertyNameForDisplay?has_content> + <#assign propertyNameForDisplay = editConfiguration.objectPropertyNameForDisplay /> + <#if editMode = "edit" > <#assign titleVerb = "Edit" /> <#assign objectLabel = editConfiguration.pageData.objectLabel /> @@ -88,11 +92,11 @@ acMultipleTypes: 'true', submitButtonTextType: 'simple', editMode: '${editMode}', - typeName:'object', + typeName:'${propertyNameForDisplay}', supportEdit: 'true', sparqlForAcFilter: '${sparqlForAcFilter}', sparqlQueryUrl: '${sparqlQueryUrl}', - defaultTypeName: 'thing' // used in repair mode to generate button text + defaultTypeName: '${propertyNameForDisplay}' // used in repair mode to generate button text };