title: for loop in order to validate my values in reduxForm
body: <p>I want to validate before submitting my values and in order not to write the same code for all the fields I want to create a for loop in order to validate all of them. More specifically:</p>
  
  <pre><code>const validate = values =&gt; {
  const errors = {};
  if (!values.measuring_point) {
      errors.measuring_point = i18n.t("Required");
  }
  if (values.image) {
      if (!/^image.*$/.test(values.image.type)) {
          errors.image = i18n.t("Only image files are allowed");
      }
  }
  let i = null;
  let measurements = [values.measurement_1, values.measurement_2, values.measurement_3, values.measurement_4, values.measurement_5, values.measurement_6];
  let errors_measurements = [errors.measurement_1, errors.measurement_2, errors.measurement_3, errors.measurement_4, errors.measurement_5, errors.measurement_6];
  let types = [values.measurement_type_1, values.measurement_type_2, values.measurement_type_3, values.measurement_type_4, values.measurement_type_5, values.measurement_type_6];
  let errors_types = [errors.measurement_type_1, errors.measurement_type_2, errors.measurement_type_3, errors.measurement_type_4, errors.measurement_type_5, errors.measurement_type_6];
  let unit = [values.measurement_unit_1, values.measurement_unit_2, values.measurement_unit_3, values.measurement_unit_4, values.measurement_unit_5, values.measurement_unit_6];
  let errors_unit = [errors.measurement_unit_1, errors.measurement_unit_2, errors.measurement_unit_3, errors.measurement_unit_4, errors.measurement_unit_5, errors.measurement_unit_6];
  for (i = 1; i &lt; 7; i++) {
      if (types[i] &amp;&amp; measurements[i] &amp;&amp; !unit[i]) {
          errors_unit[i] = i18n.t("Required");
      }
  }
  return errors;};
  </code></pre>
  
  <p>But it does not work and it does not give any error</p>