question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is the correct syntax for multiple rules

See original GitHub issue

I have input fields that looks like this:


<input class="img1" type="file" v-validate ="{ rules: { required: imgGroupVal, image: true, size: 8192, mimes: 'image/jpeg,image/jpg,image/png', ext: 'jpg,jpeg,png' } }" >

<input class="img2" type="file" v-validate ="{ rules: { required: imgGroupVal, image: true, size: 8192, mimes: 'image/jpeg,image/jpg,image/png', ext: 'jpg,jpeg,png' } }" >

The only problem is that mimes: 'image/jpeg,image/jpg,image/png', ext: 'jpg,jpeg,png' always fails.

I have also tried to write the rule like this:

v-validate="'required:imgGroupVal|image|size:8192|mimes:image/jpeg,image/jpg,image/png|ext:jpg,jpeg,png'"

But then my required rule doesnt work that is driven by a computed value imgGroupVal

So how do I need to change my syntax bellow in order to make it work v-validate ="{ rules: { required: imgGroupVal, image: true, size: 8192, mimes: 'image/jpeg,image/jpg,image/png', ext: 'jpg,jpeg,png' } }"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kiwo12345commented, Mar 7, 2018

@logaretm oh I see. Well thanks again for the help! Its an awesome lib!

1reaction
logaretmcommented, Mar 7, 2018

No, you will just pass it as an object directly which works fine, I didn’t update the example properly:

v-validate ="{ required: imgGroupVal, image: true, size: 8192, mimes: ['image/jpeg', 'image/jpg', 'image/png'], ext: ['jpg', 'jpeg', 'png'] }"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Rule syntax examples
The following example shows the syntax for a rule: TARGETS: CONDITIONS;. Use the following elements when creating a rule: You can have multiple...
Read more >
Rule syntax
This document describes Semgrep's YAML rule syntax including required and optional fields. ... pattern-either *, array, Logical OR of multiple patterns.
Read more >
IF AND in Excel: nested formula, multiple statements, and ...
The tutorial shows how to use IF together with the AND function in Excel to check multiple conditions in one formula.
Read more >
CSS Syntax
CSS Syntax ... A CSS rule consists of a selector and a declaration block. ... Multiple CSS declarations are separated with semicolons, and...
Read more >
GNU Make - Writing Rules
If the first rule has multiple targets, only the first target is taken as the ... the contents of the existing target file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found