2

I am using the jQuery Validation plugin (v1.12.0) to validate an HTML form. When using the default validate() method on the form (without any rules), it checks the text inputs for min/max values and, since the input value is a string, returns the following message: Please enter a value greater than or equal to 0.

Any idea what causes this behavior, and how I can stop the plugin from automatically validating these inputs so it only validates according to what's specified in the rules object?

Following is the code that reproduces the issue:

<html>
<head>
        <title>Validation Test Page</title>

</head>
<body>

<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery.validate.min.js"></script>

<div id="main_div">
        <div id="content_div">
                <h2 id="title">Validation Test Page</h2>
                <form id="new_customer_form" class="validate" action="generate.php" method="post" enctype="multipart/form-data">

                        Customer Name: <input id="inp_cust_name" class="tooltip" type="text"
                                name="inp_cust_name">

                        Title: <input id="inp_title" class="tooltip" type="text" name="inp_title"><br>

                        Custom text: <textarea id="inp_text" class="tooltip" name="inp_text" placeholder="Enter text here"></textarea><br>

                        Customer logo: <input id="inp_file" class="tooltip" type="file" name="inp_file"><br>

                        <div id="action_div_create">
                                <input id="inp_submit" type="submit" name="inp_submit" value="Submit">
                                <a href="./"><button type="button">Cancel</button></a>
                        </div>

                </form>
                <script>
                        $(document).ready(function() {
                                $("#new_customer_form").validate({
                                        rules: {
                                                inp_cust_name : {
                                                        required: true
                                                }
                                        }

                                });
                        });


                </script>

        </div>
</div>

</body>
</html>
1
  • If the solution was to update jQuery, then post that as an answer below, rather than editing the question. Thanks. Commented May 4, 2014 at 15:20

1 Answer 1

1

This was happening when using jQuery 1.3.2. When changing to jQuery 1.11.1 the issue disappeared. This could be a bug or something else - please feel free to add any useful information if you have any.

Sign up to request clarification or add additional context in comments.

1 Comment

This is not a bug so much as this is simply gross incompatibility of a plugin with a very old version of jQuery. jQuery 1.3.2 is so old (circa 2009), this is akin to saying that Facebook.com looks strange in Internet Explorer version 5.5. It was just never meant to happen.

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.