php - Jquery Live Form Validation -


i'm using plugin perform live form validation geektantra

this working , validating of form fields bar one.

i'm trying see if username entered field matches value in array , if return 'username in use' message. data being collected using php, converted lowercase , written jquery array.

checking array using console.log(username) shows :

["bob", "brian", "charlie", "mike", "dave", "simon", "lincoln", "reg", "bill"]  

the rule i'm using is:

    jquery("#name").validate({         expression: "if ($.inarray(val.tolowercase(), username)!==-1) return true; else return false;",         message: "username in use"     }); 

yet never seem results expected. looking @ array can see reg in use, if enter reg or reg etc in form field, doesn't match array. if enter phil told in use, when it's not.

what doing wrong ?

thanks

update

this works.. why ?

expression: "if ($.inarray(val.tolowercase(), username)<=-1) return true; else return false;", 

i think syntax error

try change=>

from--

if ($.inarray(val.tolowercase(), username)!==-1)

to---

if ($.inarray(val.tolowercase(), username)!=-1)


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -