NIHVIVO-2864: account ftl and css changes and new js to disable save until user makes a change

This commit is contained in:
tworrall 2011-09-16 15:21:24 +00:00
parent ff05d69b69
commit 5a64431b71
5 changed files with 59 additions and 6 deletions

View file

@ -0,0 +1,39 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
// Sets up event listeners so that the submit button gets enabled only if the user has changed
// an existing value.
//
// Used with both the userAccounts--myAccounts.ftl and userAccounts--edit.ftl.
$(document).ready(function(){
var theForm = $('form').last();
var theSubmitButton = theForm.find(':submit');
theSubmitButton.addClass("disabledSubmit");
$('input').each(function() {
if ( $(this).attr('type') != 'submit' && $(this).attr('name') != 'querytext') {
$(this).change(function() {
theSubmitButton.removeAttr('disabled');
theSubmitButton.removeClass("disabledSubmit");
});
$(this).bind("propertychange", function() {
theSubmitButton.removeAttr('disabled');
theSubmitButton.removeClass("disabledSubmit");
});
$(this).bind("input", function() {
theSubmitButton.removeAttr('disabled');
theSubmitButton.removeClass("disabledSubmit");
});
}
});
$('select').each(function() {
$(this).change(function() {
theSubmitButton.removeAttr('disabled');
theSubmitButton.removeClass("disabledSubmit");
});
});
});