我正在尝试执行此操作,但我无法理解为什么它什么都不做!
我认为问题出在按钮上。
PD:非常感谢您提前合作。编辑:这是完整的代码。
<?php
require_once("scr/insert.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="css/estilo.css" type="text/css"/>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="side">
<div class="logo"></div>
<div class="tvimagen">
<h1>sign up with your
beauty salon
<strong>and win a 42" tv</strong></h1>
</div>
</div>
<div class="formulario">
<form action="scr/insert.php" id="formform" method="post">
<label for="salon">Beauty Salon Name:</label>
<input type="text" name="salon" />
<label for="owner">Owner:</label>
<input type="text" name="owner" />
<label for="owner_bdate">Owner's date of birth: <em>(optional)</em></label>
<input type="text" name="owner_bdate" />
<label for="address">Address:</label>
<input type="text" name="address" />
<label for="zip">Zip Code:</label>
<input type="text" name="zip" />
<label for="seats">Number of Seats:</label>
<input type="text" name="seats" />
<label for="phone">Phone:</label>
<input type="text" name="phone" />
<label for="email">Email:</label>
<input type="text" name="email" />
<label for="seller">Seller Name:</label>
<input type="text" name="seller" />
<label for="website">Website:</label>
<input type="text" name="website" />
<span>
<input type="checkbox" name="terms" value="1" />
<p>I accept the Terms and Conditions</p>
</span>
<!-- <a href="javascript:;" class="enviarbt" onclick="validate()">register</a> -->
<input type="submit" class="enviarbt" value="Register" onclick="jodete()" id="boton">
</form>
</div>
</div>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<!-- <script type="text/javascript" src="js/jqfunc-1.0.0.js"></script> -->
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript">
$(function(){
$("#formform").validate({
rules :{
salon: {required: true, minlength: 5},
owner: {required: true, minlength: 4, maxlength: 20},
//owner_bdate: {required: true},
address: {required: true, minlength: 15},
zip: {required: true, number: true},
seats: {required: true, number: true},
phone: {required: true, number: true},
email: {required: true, email: true},
seller: {required: true, minlength: 4, maxlength 20},
website: {url: true}
}
});
});
</script>
</body>
</html>
答案 0 :(得分:0)
我猜您没有注意到控制台中的JavaScript错误。
您有语法错误...
seller: {required: true, minlength: 4, maxlength 20}
应该是......
seller: {required: true, minlength: 4, maxlength: 20}
(您在:
之后错过了冒号maxlength
)
DEMO:http://jsfiddle.net/9z4G6/
顺便说一句,您还可以将minlength
和maxlength
规则合并到rangelength
规则中......
rangelength: [4,20]