简体   繁体   中英

Parsley validation input=file type required error message

I have a form with multiple file upload and the file field is required field with at-least one file is required to upload..

<input  type="file" class="upload" name="file[]" multiple required/>

And class upload having on change event function to display list of uploaded files for that field and file type checking purpose.

My problem is on ajax form submit always parsley.validate return false..If i choose files also it returns false.

var check = $('#form').parsley().validate();
alert(check);

Any idea?

Should work. As always, post a live example

you can use this to check number of files in input

if( document.getElementById("uploadFile").files.length == 0 ){
    console.log("no files selected");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM