jQuery remote validator server generated error messages are not being displayed -


this question has answer here:

i using jquery validator validate form. server returns true if email not being used, , this email being used if being used. using firebug, see responses jquery validator's requests either being true or this email being used, , believe server working appropriately.

when server returns these errors, however, not being displayed errors. other non-remote errors invalid email, however, being displayed. while remote errors not being displayed, in fact preventing form being submitted.

as shown below, using custom client-side messages, have removed them thinking might responsible, same outcome.

edit. server returning 'true' no error, , 'some error message' error. if server returns 'false', however, client side message displayed.

how have jquery validator display server generated error messages?

{     "ignore": [],     "rules": {         "email": {             "email": true,             "maxlength": 45,             "invite":true,             "remote": "opencontactemail"         }     },     "messages": {         "email": {             "email":"please enter valid email address.",             "remote":"another contact using email account."         }     },     "data": {         "email": {             "id": 123         }     },     "remote": "path_to_validation_file.php" } 

you can configure remote returning json having iserror , message.

then configure datafilter function return message.

 remote: {         url: "path_to_validation_file.php" },         datafilter: function(data) {             var json = json.parse(data);             if(json.iserror == "true") {                 return "\"" + json.errormessage + "\"";             } else {                 return '';             }          }     } 

they recommending this


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -