Problem with eval function
<p>Hello I get a weird error in this code:</p>

<pre><code> function validateForm(aform) {
  var s="";

  //check if form has validator arr
  if (aform.validatorArr)  {
    //Iterate over Form elements
    for (var i=0;i&lt;aform.validatorArr.length;i++)  {
      eval("var anelem=document.forms."+aform.name+"."+aform.validatorArr[i][1]);
      var pattern=getPatternByName(aform.validatorArr[i][2]);

      if (aform.validatorArr[i][4]=="radio") {
        var fv="";

        eval("var chkArray=aform."+aform.validatorArr[i][1]+";");

        for (j=0;j&lt;chkArray.length;j++)  {
          if (chkArray[j].checked) {
            fv=chkArray[j].value;
          }
        }

        if (validateValue(fv,pattern)==false)  {
          s+=aform.validatorArr[i][3]+"\n";
        }

      } else {
        if (validateField(anelem,pattern)==false)  {
          s+=aform.validatorArr[i][3]+"\n";
        }
      }
    }

    //Report errors
    if (s!="") {
      alert(s);
      return false;
    }

  }

  return true;
}
</code></pre>

<p>missing ] after element list
Line 217</p>

<p>This is line 217:</p>

<pre><code> eval("var anelem=document.forms."+aform.name+"."+aform.validatorArr[i][1]);
</code></pre>

<p>Any idea's what's wrong?</p>

<h2>Update</h2>

<p>This is how de function is called: submitForm('formbuilder_form');
Which is identical to the form name:</p>

<pre><code>    &lt;form name="formbuilder_form" method="POST" action="processform.php" style="margin:0px"&gt;
</code></pre>

<p><strong>PROBLEM SOLVED</strong></p>

<p>In onw of the form element someone decided it was good to have it like this:</p>

<p></p>

<p>Js doesn't like this.</p>

<p>Thanks for helping everyone. </p>
