How to combine and make the validating functions work together this JavaScript work with calling in another function?
<p>For some reason I can't get this code to work with <code>formValidator</code> (that has been called), please check to see if the code is correct and name some possibilities. This inline is for length/height because the external has validation for the mobile number and is validated in a different method using <code>getElementById</code>.</p>

<pre><code>&lt;script type="text/javascript"&gt;
function validateForm() { /*the varible of the inline function*/
  formValidator(); /*calling the external function (validates everything else except height and length. cant use this function because it validates mobile(requires exactly 10 digits) with a different method of validating (getElementById))*/

  var form = document.forms['inputForm']; /*form is a document, inputForm, puts the validation into the form.*/
  var formats = { /*array that validates the requirements for the form text.*/
    length: /^\d[0-9]$/,
    /*only digits 0-9 */
    height: /^\d[0-9]$/,
    /*validating input of them form */
  }
  var length = form.length.value; /*in the form, calling length is the name, and value shows how long the string/text is (whats in the form.)  */
  var height = form.height.value;
  var area = length * height /*length by the height*/
  var elCount = form.elements.length; /*checks if the form has been entered, if not it returns false and gives the alert message.*/
  for (var i = 0; i &lt; elCount; i++) { /*i is the place holder for the interga (0) , checks if i is smaller then elcount, it goes by 1(1+1) each loop */
    var field = form.elements[i]; //elements of the form(returns if 0 or 1.)            
    if (field.type == 'text') { /*field type is a text box.*/
      if (!formats[field.name].test(field.value)) { /*if not the varible formats, has been typed in correct or false. */
        alert('invalid ' + field.name.replace('_', ' ') + '.'); /*alerts the name of the input and pops an alert saying its invalid. */
        field.focus();
        return false; /*returns the form false, not allowing the form to b submited.*/
      }
    }
  }
  alert('The information you have submitted is correct, the form will now submit.') /*wen u press submit signifies you having filled it out successfully */
}
&lt;/script&gt;
</code></pre>
