updates for autocomplete.

This commit is contained in:
hjkhjk54 2011-12-07 14:41:50 +00:00
parent b1db3b2daa
commit 51cf5e1846
2 changed files with 24 additions and 3 deletions

View file

@ -179,6 +179,8 @@ var customForm = {
this.initFormWithValidationErrors(); this.initFormWithValidationErrors();
//Hide verify match when edit mode //Hide verify match when edit mode
this.verifyMatch.hide(); 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 // 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) { if(this.editMode == 'edit' && this.supportEdit) {
this.verifyMatch.show(); this.verifyMatch.show();
} }
if(this.supportEdit) {
//On initialization in this mode, submit button is disabled
this.button.removeAttr('disabled');
}
this.setButtonText('existing'); this.setButtonText('existing');
this.cancel.unbind('click'); this.cancel.unbind('click');
@ -398,6 +404,12 @@ var customForm = {
if (this.formSteps > 1) { if (this.formSteps > 1) {
this.acSelection.find('label').html('Selected '); 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. // First case applies on page load; second case applies when the type gets changed.
if (!this.acSelector.val() || this.acSelector.hasClass(this.acHelpTextClass)) { if (!this.acSelector.val() || this.acSelector.hasClass(this.acHelpTextClass)) {
typeText = this.getTypeNameForLabels(); 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); .addClass(this.acHelpTextClass);
} }
}, },

View file

@ -9,6 +9,10 @@
<#assign objectTypes = editConfiguration.pageData.objectTypes /> <#assign objectTypes = editConfiguration.pageData.objectTypes />
<#assign sparqlForAcFilter = editConfiguration.pageData.sparqlForAcFilter /> <#assign sparqlForAcFilter = editConfiguration.pageData.sparqlForAcFilter />
<#assign editMode = editConfiguration.pageData.editMode /> <#assign editMode = editConfiguration.pageData.editMode />
<#assign propertyNameForDisplay = "" />
<#if editConfiguration.objectPropertyNameForDisplay?has_content>
<#assign propertyNameForDisplay = editConfiguration.objectPropertyNameForDisplay />
</#if>
<#if editMode = "edit" > <#if editMode = "edit" >
<#assign titleVerb = "Edit" /> <#assign titleVerb = "Edit" />
<#assign objectLabel = editConfiguration.pageData.objectLabel /> <#assign objectLabel = editConfiguration.pageData.objectLabel />
@ -88,11 +92,11 @@
acMultipleTypes: 'true', acMultipleTypes: 'true',
submitButtonTextType: 'simple', submitButtonTextType: 'simple',
editMode: '${editMode}', editMode: '${editMode}',
typeName:'object', typeName:'${propertyNameForDisplay}',
supportEdit: 'true', supportEdit: 'true',
sparqlForAcFilter: '${sparqlForAcFilter}', sparqlForAcFilter: '${sparqlForAcFilter}',
sparqlQueryUrl: '${sparqlQueryUrl}', sparqlQueryUrl: '${sparqlQueryUrl}',
defaultTypeName: 'thing' // used in repair mode to generate button text defaultTypeName: '${propertyNameForDisplay}' // used in repair mode to generate button text
}; };
</script> </script>