Hi,
I am using jquery form validation and jquery multiple file upload script but I am having problem with it. My multiple upload script works like this

 <input type="file" name="userfile[]" size="20" class="multi MultiFile-applied" type="file" maxlength="5" accept="gif|jpg" />

and I dont want to apply jquery validation code on this field but I am getting this error." Please enter no more than 5 characters". How can I get rid of this error and my form validation for other fields is as follow

<script type="text/javascript">

    $().ready(function() {

        // validate signup form on keyup and submit
        $("#adForm").validate({
            rules: {
                name: "required",
                            first_name:"required",
                            last_name:"required",
                                 capacity:{
                                required:true
                            },

                phone: {
                    required: true,
                    minlength: 7

                },
                email: {
                    required: true,
                    email: true
                },



            },
            messages: {
                name: "Please enter name",
                            first_name:"Please enter first name",
                            last_name:"Please enter last name",

                price: {
                    required: "Please enter price"
                    },
                phone: {
                    required: "Please provide a phone"

                },
                email: "Please enter a valid email address"

            }
        });



    });

Can anyone help. Thanks in advance.

Recommended Answers

All 2 Replies

Member Avatar for diafol

Remove maxlength="5" ?

But I have to keep maxlength attribute as in my multiple image upload script maxlenth controls the number of images and when I apply the maxlength attribute it starts giving me error is there any possible way to ignore the rule for this specific fields. thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.