Conflict between 2 ValidateRequiredFields scripts on page with 2 forms
<p>I have a page featuring 2 forms, both containing name and email address required fields. Both forms have unique ID and names, and the required fields are also uniquely named. I have 2 sets of ValidateRequiredFields scripts in the document head, and the form that the second script applies to is flagging that the required fields of the form that the first script applies too need completion.
Here is the script:</p>

<pre><code>    &lt;script type="text/javascript" language="JavaScript"&gt;
&lt;!-- Copyright 2005 Bontrager Connection, LLC
//
// Two places need to be customized.
//
//
// Place 1:
// Between the quotation marks, specify the name of 
//    your form.

var FormName = "theForm2";


// Place 2:
// Between the quotation marks, specify the field names 
//    that are required. List the field name separated 
//    with a comma.

var RequiredFields = "FullName,EmailAddress";


//
// No other customization of this JavaScript is required.
//
/////////////////////////////////////////////////////////

function ValidateRequiredFields()
{
var FieldList = RequiredFields.split(",")
var BadList = new Array();
for(var i = 0; i &lt; FieldList.length; i++) {
    var s = eval('document.' + FormName + '.' + FieldList[i] + '.value');
    s = StripSpacesFromEnds(s);
    if(s.length &lt; 1) { BadList.push(FieldList[i]); }
    }
if(BadList.length &lt; 1) { return true; }
var ess = new String();
if(BadList.length &gt; 1) { ess = 's'; }
var message = new String('\n\nThe following field' + ess + ' are required:\n');
for(var i = 0; i &lt; BadList.length; i++) { message += '\n' + BadList[i]; }
alert(message);
return false;
}

function StripSpacesFromEnds(s)
{
while((s.indexOf(' ',0) == 0) &amp;&amp; (s.length&gt; 1)) {
    s = s.substring(1,s.length);
    }
while((s.lastIndexOf(' ') == (s.length - 1)) &amp;&amp; (s.length&gt; 1)) {
    s = s.substring(0,(s.length - 1));
    }
if((s.indexOf(' ',0) == 0) &amp;&amp; (s.length == 1)) { s = ''; }
return s;
}
// --&gt;


&lt;/script&gt;




&lt;script type="text/javascript" language="JavaScript"&gt;
&lt;!-- Copyright 2005 Bontrager Connection, LLC
//
// Two places need to be customized.
//
//
// Place 1:
// Between the quotation marks, specify the name of 
//    your form.

var FormName = "theForm";


// Place 2:
// Between the quotation marks, specify the field names 
//    that are required. List the field name separated 
//    with a comma.

var RequiredFields = "Name,Email";


//
// No other customization of this JavaScript is required.
//
/////////////////////////////////////////////////////////

function ValidateRequiredFields()
{
var FieldList = RequiredFields.split(",")
var BadList = new Array();
for(var i = 0; i &lt; FieldList.length; i++) {
    var s = eval('document.' + FormName + '.' + FieldList[i] + '.value');
    s = StripSpacesFromEnds(s);
    if(s.length &lt; 1) { BadList.push(FieldList[i]); }
    }
if(BadList.length &lt; 1) { return true; }
var ess = new String();
if(BadList.length &gt; 1) { ess = 's'; }
var message = new String('\n\nThe following field' + ess + ' are required:\n');
for(var i = 0; i &lt; BadList.length; i++) { message += '\n' + BadList[i]; }
alert(message);
return false;
}

function StripSpacesFromEnds(s)
{
while((s.indexOf(' ',0) == 0) &amp;&amp; (s.length&gt; 1)) {
    s = s.substring(1,s.length);
    }
while((s.lastIndexOf(' ') == (s.length - 1)) &amp;&amp; (s.length&gt; 1)) {
    s = s.substring(0,(s.length - 1));
    }
if((s.indexOf(' ',0) == 0) &amp;&amp; (s.length == 1)) { s = ''; }
return s;
}
// --&gt;


&lt;/script&gt;
</code></pre>

<p>and here are the first couple of lines of code for each form: </p>

<p>FORM 1                                    </p>

<pre><code>     &lt;form action="contactengine_required.php" method="post" name="theForm2" id="theForm2" onsubmit="return ValidateRequiredFields();" &gt;
 &lt;input class="span7" type="text" name="FullName" id="FullName" placeholder="Full Name (required)" /&gt;
  &lt;input class="span7" type="text" name="EmailAddress" id="EmailAddress" placeholder="Email (required)" /&gt;
</code></pre>

<p>FORM 2</p>

<pre><code>         &lt;form action="contactengine_required_footer.php" method="post" name="theForm" id="theForm" onsubmit="return ValidateRequiredFields();" &gt;
                                    &lt;div class="clearfix"&gt;
                                        &lt;label for="Name"&gt;&lt;span style="color: #FFF; font-size: 12px"&gt;*Name:&lt;/span&gt;&lt;/label&gt;
      &lt;input class="span4" type="text" name="Name" id="Name"/&gt;



                                    &lt;/div&gt;

                                    &lt;div class="clearfix"&gt;
                                        &lt;label for="Email"&gt;&lt;span style="color: #FFF; font-size: 12px"&gt;*Email:&lt;/span&gt;&lt;/label&gt;
</code></pre>

<p>The development page is <a href="http://www.bhutansuites.com/2013/reservation.html" rel="nofollow">here.</a> Any help with sorting this out would be so appreciated!</p>
