From: Jeff Godin Date: Wed, 30 Oct 2013 19:29:24 +0000 (-0400) Subject: Treat empty username as invalid in user editor X-Git-Tag: sprint4-merge-nov22~2447 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=48c1b5bcf4903b6705c981f5072ca8ce8537e343;p=working%2FEvergreen.git Treat empty username as invalid in user editor There seems to be undesired interaction between the required attribute and the isValid method on a dojo/dijit ValidationTextBox. If both are set, isValid needs to check for an empty value, otherwise the field is considered valid the moment it gains focus. We don't want an empty username to be considered valid, because we know that we will be unable to save the user. We can work around this by teaching the isValid function to consider an empty value as invalid. Signed-off-by: Jeff Godin Signed-off-by: Melissa Ceraso Signed-off-by: Ben Shum --- diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index aabdc3c203..daccc51620 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -1347,6 +1347,10 @@ function attachWidgetEvents(fmcls, fmfield, widget) { case 'usrname': widget.widget.isValid = function() { + // Not empty + if(this.attr("value") == '') { + return false; + } // No spaces if(this.attr("value").match(/\s/)) { return false;