Skip to content

Instantly share code, notes, and snippets.

Created March 30, 2012 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2253002 to your computer and use it in GitHub Desktop.
Save anonymous/2253002 to your computer and use it in GitHub Desktop.
signup.html
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js" >
</script>
<script>
$(document).ready(function() {
// validate signup form on keyup and submit
var validator = $("#signupform").validate({
rules: {
email_address:
{
required: true,
email: true,
remote: {
url: "signup/email/check/",
type: "post"
}
},
first_name: "required",
last_name: "required",
username: {
required: true
},
password: {
required: true,
minlength: 5
},
confirm_password: {
required: true,
minlength: 5,
equalTo: "#id_password"
},
},
messages: {
email_address: {
required: "Please enter a valid email address",
minlength: "Please enter a valid email address",
remote: jQuery.format("{0} is already in use")
},
first_name: "Enter your firstname",
last_name: "Enter your lastname",
username: {
required: "Please enter a valid username"
},
password: {
required: "Provide a password",
minlength: jQuery.format("Enter at least {0} characters")
},
confirm_password: {
required: "Repeat your password",
minlength: jQuery.format("Enter at least {0} characters"),
equalTo: "Enter the same password as above"
},
}
});
});
</script>
<body>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<form action="/signup/" method="POST" id="signupform">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="SignUp" />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment