Jquery.Validation file upload allows post even with other invalid fields

0

Use jquery.validation v.1.17 and additional-methods.js to validate multiple fields, including file uploads . I use the bootstrap and program in C # .NET . There is no UpdatePanel on the page. After loading the form, when you click Save, all the fields appear with the validation msg and it is not done post on the page. All right until then .. ButifIfillinoneoftheFileUploadanditpassesinthevalidationthepostisdone,eventhoughtheotherfieldsarenotyetvalidated!Theerrormessagesoftheothersuntiltheyappear..butthepostisdone.

Followthejavascriptcode:

$('#aspnetForm').validate({rules:{ctl00$cphMain$ucFormularioInscricaoResposta$ctl_1975:{required:true,date:true},ctl00$cphMain$ucFormularioInscricaoResposta$ctl_1946$fileUpload:{extension:'jpg,pdf,doc',maxSize:5*1024*1024,required:true},ctl00$cphMain$ucFormularioInscricaoResposta$ctl_1973$fileUpload:{extension:'jpg,pdf,doc',required:true}},errorPlacement:function(error,element){varobj=$('[name="' + element.attr('name') + '"]');
            if (obj.length > 1) {
                error.insertAfter(obj.last().parent());
            } else {
                error.insertAfter(obj);
            }
        },
        onsubmit: false
    });

    
asked by anonymous 02.02.2018 / 13:22

0 answers