jQuery Validation username check (DB)
Hi,
I was building a user registration form using jQuery Validation and I thought that it should have a user-name validation check...
This not that difficult to make however the examples I found is based on simple forms with submit type buttons. The thing is that I forced validation to be triggered when a simple button type object is clicked, so I am not shure if the same codes I found will do...
How ever I do not cope with the side of user-name checking...
Here is my username-check.php
- <?php
- include 'connect.php';
- $name = mysql_real_escape_string($name);
- $query = "SELECT user_name FROM users WHERE user_name='$name';";
- $res = mysql_query($query);
- if (mysql_num_rows($res) > 0) {
- $output = true;
- } else {
- $output = false;
- }
- echo json_encode($output);
- ?>
Now here is some js snipets
- //in rules
- username: {
- required: true,
- minlenght: 6,
- remote: "check-username.php"
- },
- //in messages
- username: {
- required: "Please enter a username",
- minlength: "Your username must consist of at least 6 characters",
- remote: "Somenoe have already chosen nick like this."
- },
and result I get...
- $.validator.methods[method] is undefined
- (function($){$.extend($.fn,{validate:f...ed when checking element "+element.id
jquery....min.js (line 15)
any help?