fix onsubmit problem

This commit is contained in:
DOHA 2015-04-02 19:14:57 +02:00
parent d2a1805050
commit 1e416706ee
1 changed files with 16 additions and 3 deletions

View File

@ -23,7 +23,7 @@ color:#000;
<spring:message code="label.form.title"></spring:message> <spring:message code="label.form.title"></spring:message>
</h1> </h1>
<br> <br>
<form action="/" method="POST" enctype="utf8" onsubmit="register()"> <form action="/" method="POST" enctype="utf8">
<div class="form-group row" > <div class="form-group row" >
<label class="col-sm-3"><spring:message code="label.user.firstName"></spring:message></label> <label class="col-sm-3"><spring:message code="label.user.firstName"></spring:message></label>
<span class="col-sm-5"><input class="form-control" name="firstName" value="" required/></span> <span class="col-sm-5"><input class="form-control" name="firstName" value="" required/></span>
@ -64,14 +64,27 @@ color:#000;
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$('form').submit(function(event) {
register(event);
});
$('#password').keyup(function(){
if($("#password").val() != $("#matchPassword").val()){
$("#globalError").show().html("Password mismatch");
}
});
options = { options = {
common: {minChar:8}, common: {minChar:8},
ui: {showVerdictsInsideProgressBar:true,showErrors:true} ui: {
showVerdictsInsideProgressBar:true,
showErrors:true
}
}; };
$('#password').pwstrength(options); $('#password').pwstrength(options);
}); });
function register(){ function register(event){
event.preventDefault(); event.preventDefault();
$(".alert").html("").hide(); $(".alert").html("").hide();
$(".error-list").html(""); $(".error-list").html("");