Fix javascript for white space message for register.jsp

This commit is contained in:
Sofia Baltzi 2018-05-08 09:59:31 +00:00
parent 8fa3d0f6c4
commit 87ebab0b73
2 changed files with 7 additions and 6 deletions

View File

@ -109,12 +109,12 @@
<span class="msg_password_error uk-text-danger uk-text-small uk-float-left" style="${msg_password_error_display}">Please enter your password.</span> <span class="msg_password_error uk-text-danger uk-text-small uk-float-left" style="${msg_password_error_display}">Please enter your password.</span>
<span class="msg_pass_conf_error uk-text-danger uk-text-small uk-float-left" style="${msg_pass_conf_error_display}">These passwords don't match.</span> <span class="msg_pass_conf_error uk-text-danger uk-text-small uk-float-left" style="${msg_pass_conf_error_display}">These passwords don't match.</span>
<p> <p>
<span class="msg_whitespace uk-text-danger uk-text-small uk-float-left" style="display:none">White space is not allowed</span>
<span class="msg_please_add uk-text-danger uk-text-small uk-float-left" style="display:none">Please add: &nbsp</span></p> <span class="msg_please_add uk-text-danger uk-text-small uk-float-left" style="display:none">Please add: &nbsp</span></p>
<span class="msg_lowercase_letter uk-text-danger uk-text-small uk-float-left" style="display:none">A lowercase letter. &nbsp</span> <span class="msg_lowercase_letter uk-text-danger uk-text-small uk-float-left" style="display:none">A lowercase letter. &nbsp</span>
<span class="msg_capital_letter uk-text-danger uk-text-small uk-float-left" style="display:none">A capital (uppercase) letter. &nbsp </span> <span class="msg_capital_letter uk-text-danger uk-text-small uk-float-left" style="display:none">A capital (uppercase) letter. &nbsp </span>
<span class="msg_number uk-text-danger uk-text-small uk-float-left" style="display:none">A number. &nbsp</span> <span class="msg_number uk-text-danger uk-text-small uk-float-left" style="display:none">A number. &nbsp</span>
<span class="msg_lenght uk-text-danger uk-text-small uk-float-left" style="display:none">Minimum 6 characters (no white space allowed). &nbsp</span> <span class="msg_lenght uk-text-danger uk-text-small uk-float-left" style="display:none">Minimum 6 characters. &nbsp</span>
<p><span class="msg_whitespace uk-text-danger uk-text-small uk-float-left" style="display:none">No white space allowed. &nbsp</span></p>
<span class="msg_invalid_password uk-text-danger uk-text-small uk-float-left" style="${msg_invalid_password_display}">The password must <span class="msg_invalid_password uk-text-danger uk-text-small uk-float-left" style="${msg_invalid_password_display}">The password must
contain a lowercase letter, a capital (uppercase) letter, a number and must be at least 6 characters long. White space character is not allowed.</span> contain a lowercase letter, a capital (uppercase) letter, a number and must be at least 6 characters long. White space character is not allowed.</span>
<input id="password" name="password" type="password" placeholder="Password" class="form-control"></div> <input id="password" name="password" type="password" placeholder="Password" class="form-control"></div>
@ -147,10 +147,11 @@
// When the user starts to type something inside the password field // When the user starts to type something inside the password field
myInput.onkeyup = function() { myInput.onkeyup = function() {
if (/\s/g.test(myInput.value)) { var space = /[\s]+/g;
$("msg_whitespace").fadeIn(); if (myInput.value.match(space)) {
$(".msg_whitespace").fadeIn();
} else { } else {
$("msg_whitespace").fadeOut(); $(".msg_whitespace").fadeOut();
} }
// Validate lowercase letters // Validate lowercase letters

View File

@ -67,7 +67,7 @@
<span class="msg_capital_letter uk-text-danger uk-text-small uk-float-left" style="display:none">A capital (uppercase) letter. &nbsp </span> <span class="msg_capital_letter uk-text-danger uk-text-small uk-float-left" style="display:none">A capital (uppercase) letter. &nbsp </span>
<span class="msg_number uk-text-danger uk-text-small uk-float-left" style="display:none">A number. &nbsp</span> <span class="msg_number uk-text-danger uk-text-small uk-float-left" style="display:none">A number. &nbsp</span>
<span class="msg_lenght uk-text-danger uk-text-small uk-float-left" style="display:none">Minimum 6 characters. &nbsp</span> <span class="msg_lenght uk-text-danger uk-text-small uk-float-left" style="display:none">Minimum 6 characters. &nbsp</span>
<p><span class="msg_space uk-text-danger uk-text-small uk-float-left" style="display:none">No white space allowed &nbsp</span></p> <p><span class="msg_space uk-text-danger uk-text-small uk-float-left" style="display:none">No white space allowed. &nbsp</span></p>
<%--<span id="server_invalid_password_error" class="uk-text-danger uk-text-small uk-float-left">${msg_invalid_password}</span>--%> <%--<span id="server_invalid_password_error" class="uk-text-danger uk-text-small uk-float-left">${msg_invalid_password}</span>--%>
<%--<c:remove var="msg_invalid_password" scope="session" />--%> <%--<c:remove var="msg_invalid_password" scope="session" />--%>
<input id="password" name="password" type="password" placeholder="Password" class="form-control"></div> <input id="password" name="password" type="password" placeholder="Password" class="form-control"></div>