3

Is someone able to solve this error? is with jquery validation 1.13.1 and jquery 1.11.1 :

  uncaught exception: $.format has been deprecated. Please use $.validator.format instead.

Whenever I disable any validation form I have ,it still show the error, so it's basically something on the validation file code isn't it? not in my form validation file where I use it like this:

    $("#free_validation").add("#validation-form").validate({
        ignore:'',
        rules: {
            title:{
                required: true,
                minlength: 2,
                alphanumericwithpunc: true
            }
        },
        messages: {
            title: {
                required: "Escriba el titulo",
                minlength: "Al menos 2 caracteres",
                alphanumericwithpunc: "Sólo alfanumérico"
            }
        }
    });

And my method like:

$.validator.addMethod("alphanumericwithpunc", function(value, element) {
    return this.optional(element) || /^[\wàáâäãåèéêëìíîïòóôöõøùúûüÿýñçčšžÀÁÂÄÃÅÈÉÊËÌÍÎÏÒÓÔÖÕØÙÚÛÜŸÝÑßÇŒÆČŠŽ∂ð,;.:'\\\_\-\¿?¡!&%$€#()\s]+$/i.test(value);
}, "Letters, numbers, and basic punctuation only please");

as they specified in their documentation :

Any help much appreciated!

The problem was my method, so i used like this now:

$.validator.addMethod("alphanumericwithpunc", function(value, element) {
        return this.optional(element) || /^[\wàáâäãåèéêëìíîïòóôöõøùúûüÿýñçčšžÀÁÂÄÃÅÈÉÊËÌÍÎÏÒÓÔÖÕØÙÚÛÜŸÝÑßÇŒÆČŠŽ∂ð,;.:'\\\_\-\¿?¡!&%$€#()\s]+$/i.test(value);
    }, jQuery.validator.format("Please enter the correct value"));
1
  • 1
    You neglected to include the code for alphanumericwithpunc, and I'm guessing that's where the problem is. I see no issues if I get rid of that bit. See my example here. Commented Mar 18, 2015 at 17:00

2 Answers 2

2

Use the new format, like,

messages: {
            title: {
                required: "Escriba el titulo",
                minlength: jQuery.validator.format("Al menos 2 caracteres"),
                alphanumericwithpunc: jQuery.validator.format("Sólo alfanumérico")
            }
        }
Sign up to request clarification or add additional context in comments.

2 Comments

I know you get that from github.com/properapp/jquery-validation/issues/3 but as I said before, even if I set none form validation code , the error comes, which make consider the possibility this to be a bug?
Have to come back now, the comment from @Ryley give me a way but marked yours as the answer since, is correct.
1

I know this is probably solved by now, but thought of sharing my version of the issue and how I solved it. Please note this doesn't directly address the core issue, but only shows how to stop that error message from appearing.

I was facing the same exact problem - just included the following two libraries into my project (which already had jQuery included)

  1. jquery.validate.js
  2. additional-methods.js (some addons on the original validation library)

and there we go, the error popped up on the console.

I did a bit of research and found out the the code which throws the error is present in line no 1313 of the file jquery.validate.js and looks like:

$.format = function deprecated() {
  throw "$.format has been deprecated. Please use $.validator.format instead.";
};

I commented out the throw statement and the error vanished. I tested by adding some validation rules into my forms and they kept working great as usual. So, not a clean solution, but gets rid of the ugly error message.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.