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();
//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);
}
},

View file

@ -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>
<#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
};
</script>