jQuery validates all required fields except file upload.

jQuery validates all required fields except file upload.

I am definitely doing something wrong and I would greatly appreciate someone pointing me in the right direction.

Many thanks in advance.


 I am trying to validate file upload along with a few other form fields.

All the form fields listed in the script below are being validate except the single file upload called BidIDFile.

Any ideas what I am doing wrong?


  1.   <script type=' text/javascript' src=" http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.js"></script>
    script type=' text/javascript'>// <![CDATA[ $(document).ready(function () {
        // We'll use this flag so we don't have to validate fields before // the form has been submitted. var validatingForm = false;
     
    // This line before validate() is called allows // chosen menus to be validated $.validator.setDefaults({ ignore: " :hidden:not(select)" });
     
        $(' #form1').validate({ // initialize the plugin         invalidHandler: function() {
            // Now we can validate the fields onChange         validateForm = true;
        },
     
            rules: {
                       errorElement: ' div',
                        txtBidDate: " required",
                        txtDueDate: " required",
                        BidTitle: " required",
                        BidID: " required",
                        CategoryID: " required",
                        BidIDFile: " required",
                        AliasID: " required",
                        BidContact: " required",
                        ContactEmail: {
                            required: true,
                            email: true
                        },
                BidType: {
                    required: true,
                },
                         BidStatus: " required"
            },
                    messages: {
                        txtBidDate: " Please enter Issue Date",
                        txtDueDate: " Please enter Due Date",
                        BidTitle: " Please enter Project Title",
                        BidID: " Please enter ID",
                        CategoryID: " Please select a Category",
                        BidIDFile: " Please select a Bid File",
                        AliasID: " Please select Department Alias",
                        BidContact: " Please enter Bid Contact",
                        BidTitle: " Please enter Project Title",
     
                        BidType: {
                            required: " Please select Bid Type"
                        },
                        ContactEmail: " Please enter a valid email address",
                        BidStatus: " Please select Bid Status"
                    },
             });
       // Now set an onChange event for the chosen menu    $(" CategoryID").change(function(){
     
           // Check that we've tried to submit the form        if(validateForm) {
               // We tried to submit the form, re-validate on change...just to get rid of the message            $(" CategoryID").valid();
           }
    });
       $(" AliasID").change(function(){
     
           // Check that we've tried to submit the form        if(validateForm) {
               // We tried to submit the form, re-validate on change...just to get rid of the message            $(" AliasID").valid();
           }
    });
       $(" BidType").change(function(){
     
           // Check that we've tried to submit the form        if(validateForm) {
               // We tried to submit the form, re-validate on change...just to get rid of the message            $(" BidType").valid();
           }
    });
       $(" BidStatus").change(function(){
     
           // Check that we've tried to submit the form        if(validateForm) {
               // We tried to submit the form, re-validate on change...just to get rid of the message            $(" BidStatus").valid();
           }
    });
    });// ]]>
    </script>
     
    <input type=" file" id=" BidIDFile" name=" BidIDFile[]" value=" " size=" 50">