diff --git a/webapp/web/css/account/account.css b/webapp/web/css/account/account.css index e883917d6..d5cca34d8 100644 --- a/webapp/web/css/account/account.css +++ b/webapp/web/css/account/account.css @@ -272,4 +272,7 @@ a.disable-delete { } #passwordContainer { margin-top: 20px; +} +.disabledSubmit { + cursor: default ! important; } \ No newline at end of file diff --git a/webapp/web/js/account/accountListenerSetup.js b/webapp/web/js/account/accountListenerSetup.js new file mode 100644 index 000000000..d811f2410 --- /dev/null +++ b/webapp/web/js/account/accountListenerSetup.js @@ -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"); + }); + }); + +}); + diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl index 2b1ada680..99c95c124 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl @@ -97,7 +97,7 @@ #if> -
or Cancel
+or Cancel
* required fields
@@ -106,4 +106,7 @@ ${stylesheets.add('')} ${stylesheets.add('')} -${scripts.add('')} +${scripts.add('', + '', + '', + '')} diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-myAccount.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-myAccount.ftl index 5ffcf2f58..c9c777511 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-myAccount.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-myAccount.ftl @@ -58,7 +58,7 @@ #if>