title: Validation at form level on multiple fields with Yup and react-hook-form
body: <p>I currently have the following Yup validation schema with react-hook-form:</p>
  <pre><code>  const schema = yup.object().shape({
      externallyPrintedLabelsQty: yup
        .number()
        .typeError(&quot;Number of Labels (printed outside) must be a number&quot;)
        .required()
        .integer()
        .min(0)
        .max(2)
        .test(
          &quot;maxLabels&quot;,
          &quot;A maximum of two labels per pack, either printed internally or externally, is allowed.&quot;,
          function (value: any) {
            const { internallyPrintedLabelsQty } = this.parent;
            return value + internallyPrintedLabelsQty &lt; 3;
          }
        ),
      internallyPrintedLabelsQty: yup
        .number()
        .typeError(&quot;Number of Labels (printed inside) must be a number&quot;)
        .required()
        .integer()
        .min(0)
        .max(2),
    });
  </code></pre>
  <p>This works fine. However, the <code>.test</code> validation is attached to a specific field (i.e. <code>externallyPrintedLabelsQty</code>).
  Is there any way to attach the <code>.test</code> to the form as a whole instead of to a specific field, or test whether at form level the user is selecting more than 2 labels, regardless if they are printed internally or externally?</p>
  <p>Thanks in advance for your help.</p>