0

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.

1
  • The jQuery Validate plugin has absolutely nothing to do wth the jQuery Validation Engine. Edited tags. Thanks. Commented Oct 27, 2017 at 20:38

1 Answer 1

0

It's probably because you already set a value for that field making the validation engine believe it has a value already, even though it's not a file. You should remove the value="Upload Image"

<input type="file" name="series_image" id="series_image" class="validate[required]"/>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.