vendredi 27 octobre 2017

How to validate "input type file" using jquery validation engine?

i am using jquery validation engine to validate a form in my Laravel's project, it works perfect for all of the fields except input type file.

here is what i have tried:

Form

<form id="series-form" enctype="multipart/form-data" method="post">
    <input type="text" name="series_fname" id="series_fname" class="validate[required]">
    <input type="text" name="series_lname" id="series_lname" class="validate[required]">
    <input type="file" name="series_image" id="series_image" class="validate[required]" value="Upload Image"/>
</form>

Jquery

$(document).ready(function(){
    $("#series-form").validationEngine({promptPosition : "topLeft", 'custom_error_messages': {
       '#series_fname': {
            'required': {
                'message': "* This field is required"
            }
        },
       '#series_lname': {
            'required': {
                'message': "* This field is required"
            }
        },
        '#series_image': {
            'required': {
                'message': "* This field is required"
            }
        },
    });
});

The first two are working fine, but it's not working for image.

Please let me know what's wrong with this.

Thanks.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2yP8Tpu
via IFTTT

Aucun commentaire:

Enregistrer un commentaire