Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of multiple file form #629

Open
jecminek opened this issue Mar 29, 2021 · 4 comments
Open

Validation of multiple file form #629

jecminek opened this issue Mar 29, 2021 · 4 comments

Comments

@jecminek
Copy link

Subject of the issue

I have a form containing some inputs and validate them with laravel-jsvalidation. Every validations work fine except multiple file input. I set rules min and max count files. It's work when it was validate withou jsvalidation and just dump error. When I use jsvalidation this only show rules for required and array.

Part of code in my request rules:
public function rules(): array { return ['images' => ['required', 'array', 'min:1', 'max:3'], }

Part of code what was generate to footer:
rules: "images":{"laravelValidation":[["Required",[],"fotky vozidla je pot\u0159eba vyplnit",true,"images"],["Array",[],"The fotky vozidla must be an array.",false,"images"],["Min",["1"],"1 polo\u017eek je minim\u00e1ln\u00ed po\u010det pro fotky vozidla",false,"images"],["Max",["3"],"3 polo\u017eek je maxim\u00e1ln\u00ed po\u010det pro fotky vozidla",false,"images"]]}

Your environment

  • version of this package: v4.4.3
  • version of Laravel: v7.0.8
@bytestream
Copy link
Collaborator

How's your form setup, can you show me some very simple HTML so I can replicate with your rules?

It sounds similar to #613 (comment)

@jecminek
Copy link
Author

I see..., but I update package.

This part HTML is for file upload
<div class="form-group"> <label for="images">Fotky vozidla*</label> <input type="file" name="images[]" accept="image/jpeg,image/jpg,image/png" class="form-control-file" multiple>
Beginning of form
<form method="POST" action="{{route('repurchase.send')}}" enctype="multipart/form-data" id="repurchase-form">

Footer script part
<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.min.js?ver=4.4.3')}}"></script> {!! JsValidator::formRequest('App\Http\Requests\RepurchaseRequest', '#repurchase-form'); !!}

@bytestream
Copy link
Collaborator

You could try using #505 until someone gets more time to figure out the issue here

@stale
Copy link

stale bot commented Apr 7, 2021

This issue/proposal has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automatically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for contributing :)

@stale stale bot added the stale label Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants