codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css' />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript" src="js/registra.js"></script>
<!--[if IE 6]>
<link href="default_ie6.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body >
<div id="header-wrapper">
<div id="header">
<div id="logo">
<h1>sito</h1>
</div>
<div id="menu">
<ul>
<li class="current_page_item">Homepage
[*]Ricerca mailinurlpag [*]Login[/list]
</div>
</div>
</div>
<div id="banner">
<div class="img-border">
<h3>Inserisci i dati per Registrarti </h3>
<form id="registra" name="registra" action="registrazioneeffettuata.php" method="POST" >
Nome
<input type="text" name="nome" id="nome" maxlength="20" >
Cognome
<input type="text" name="cognome" id="cognome" maxlength="30">
Mail
<input type="text" name="email" id="email">
Nickname
<input type="text" name="user" id="user" maxlength="12">
Password
<input type="password" name="pw1" id="pw1" maxlength="12">
Ripeti Password
<input type="password" name="pw2" id="pw2" maxlength="12">
<input type="submit" value="Registrati">
</form>
</div>
</div>
<div id="footer" class="container">
Copyright (c) 2013 </p>
</div>
</body>
</html>
Codice controllo
codice:
$(document).ready(function()
{
$("#registra").validate(
{
rules:
{
nome:{
required:true,
minlength: 3
},
cognome:{
required:true,
minlength: 2
},
email:{
required: true,
email: true
},
user:{
required: true,
minlength: 8
},
pw1:{
required:true,
minlenght:8
},
pw2:{
required: true,
equalTo: "#pw1"
},
},
messages:
{
nome:{
required : " Inserisci il tuo nome!",
minlength: "Nome troppo corto!"
},
cognome:{
required : " Inserisci il tuo cognome!",
minlength: "Cognome troppo corto!"
},
user:{
required : " Inserisci un Username!",
minlength: "L'username deve essere compreso tra 8 e 12 caratteri!"
},
pw1:{
required : " Inserisci una Password!",
minlength: "La Password deve essere compreso tra 8 e 12 caratteri!"
},
pw2: {
required:"Ridigita la password",
equalto:" La conferma non corrisponde alla scelta della password!"
},
email: " Inserisci un indirizzo email valido!",
},
});
});