fn:Juan Ignacio Borda
n:Borda;Juan Ignacio
email;internet:juanignacioborda@gmail.com
tel;work:+54-221-15-543-0660
tel;cell:Skype juan.ignacio.borda
x-mozilla-html:TRUE
version:2.1
end:vcard
you have to actually echo the result of validation: true or false
-------- Original Message --------
> Hello everyone,
>
> I'm still dealing with that signup form.
> Now I'd like to check with an Ajax call if a login is already taken.
> That's what I'm doing:
>
> $("#signup").validate( {
> rules: {
> ulogin: {
> required: true,
> // It's a custom method checking a regexp, it's working
> login: true,
> rangelength: [3,20],
> remote: "check.php?w=1"
> },
> ...
>
> Here's the check.php file:
>
> // Including the connection file, blah blah
> ...
> $valid=true;
> // Since I'm planning to use this file as a multipurpose script,
> //preventing it from stop working
> if (!isset($_REQUEST['w'])) $_REQUEST['w']=1;
> if ($_REQUEST['w']==1) {
> // If the login is taken, it will return something >0
> $number=mysql_num_rows(mysql_query("SELECT `Id` FROM `Users` WHERE `Login`='".$_REQUEST['ulogin']."'", $link));
> if ($number>0) $valid=false; else $valid=true;
> }
> After I validate, it stops working: it says incorrect for all fields
> after the second submit. After the first submit it says nothing, even
> that the login is already taken.
> What's wrong?
> Thanks!
>
>
No comments:
Post a Comment