title: how to generate error when the field is empty by using express-validator in validationResult
body: <p>I'm using express-validator.</p>
  
  <p>I want to generate an error in validationResult if the field is empty.</p>
  
  <p>This is my code:</p>
  
  <pre><code>router.post('/register',[
      check('name').isEmpty().withMessage('Name field cannot be empty.'),
      check('email').isEmail().withMessage('Enter valid email address.'),
      check('username').isEmpty().withMessage('Username cannot be empty.'),
      check('password').isEmpty().matches('password2').withMessage('Password dont match.')
  ], function(req, res, next) {
  
    const errors = validationResult(req);
    console.log(errors.array());
  
    if (!errors.isEmpty()) {
      res.render('register2',{
          errors: errors.mapped(), 
          name: req.body.name,
          email: req.body.email,
          username: req.body.username,
          password: req.body.password,
          password2: req.body.password2
      });
    }
  });
  </code></pre>
  
  <p>I want to generate error when name field and username field is empty but I only get errors for these fields:</p>
  
  <pre><code>[ { location: 'body',
  param: 'email',
  value: '',
  msg: 'Enter valid email address.' },
  { location: 'body',
  param: 'password',
  value: '',
  msg: 'Password dont match.' } ]
  </code></pre>