express-validator to validate parameter which is an array
<p>I am using <a href="https://github.com/ctavan/express-validator" rel="noreferrer">express-validator</a> to validate POST data in my express application. I have a form which has a select where in user can select multiple options:</p>

<pre><code>&lt;select name="category" multiple id="category"&gt;
    &lt;option value="1"&gt;category 1 &lt;/option&gt;
    .......
&lt;/select&gt;
</code></pre>

<p>The payload after submitting form shows me this if I select multiple values:</p>

<pre><code>...&amp;category=1&amp;category=2&amp;....
</code></pre>

<p>Now, in my Express application I try to validate it like this:</p>

<pre><code>req.checkBody('category', 'category cannot be empty').notEmpty();
</code></pre>

<p>But, even after I send multiple values I always get the error - <code>category cannot be empty</code>. If I print my variable as <code>req.body.category[0]</code> - I get the data. But, somehow not able to understand the way I need to pass this to my validator.</p>