title: Validate if one of two form fields is filled?
body: <p>At least one of the two fields is required, if field 1 is filled or field 2 is filled the form is sent, the required is just one of them filled. I'm trying to do this with the code below, but isn't working fine, this is working only validating like required the field 1 (text1). Thank you!</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var field1 = text1;
  var field2 = text2;
  
  if (text2.length) {
      if (!field1.length || !field2.length) {
          return false;
      }
  } else if (!field1.length) {
      return false;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="text" placeholder="text 1*" name="text1" class="text1" data-target="previewText1" maxlength="11"&gt;
  &lt;input type="text" placeholder="text 2" value="" name="text2" class="text2" data-target="previewText2" maxlength="11"&gt;</code></pre>
  </div>
  </div>
  </p>