Skip to content

Commit 1e41670

Browse files
committed
fix onsubmit problem
1 parent d2a1805 commit 1e41670

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

  • spring-security-login-and-registration/src/main/webapp/WEB-INF/view

‎spring-security-login-and-registration/src/main/webapp/WEB-INF/view/registration.jsp‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ color:#000;
2323
<spring:message code="label.form.title"></spring:message>
2424
</h1>
2525
<br>
26-
<form action="/" method="POST" enctype="utf8" onsubmit="register()">
26+
<form action="/" method="POST" enctype="utf8">
2727
<div class="form-group row" >
2828
<label class="col-sm-3"><spring:message code="label.user.firstName"></spring:message></label>
2929
<span class="col-sm-5"><input class="form-control" name="firstName" value="" required/></span>
@@ -64,14 +64,27 @@ color:#000;
6464

6565
<script type="text/javascript">
6666
$(document).ready(function () {
67+
$('form').submit(function(event) {
68+
register(event);
69+
});
70+
71+
$('#password').keyup(function(){
72+
if($("#password").val() != $("#matchPassword").val()){
73+
$("#globalError").show().html("Password mismatch");
74+
}
75+
});
76+
6777
options = {
6878
common: {minChar:8},
69-
ui: {showVerdictsInsideProgressBar:true,showErrors:true}
79+
ui: {
80+
showVerdictsInsideProgressBar:true,
81+
showErrors:true
82+
}
7083
};
7184
$('#password').pwstrength(options);
7285
});
7386
74-
function register(){
87+
function register(event){
7588
event.preventDefault();
7689
$(".alert").html("").hide();
7790
$(".error-list").html("");

0 commit comments

Comments
 (0)