Javascript validation in contact form when more than one form in same page
<p>I have 3 forms on the same page and everything works great if I submit form 1.  If I submit form 2 or 3 then it seems like it actually submits form 1 and I get validation warnings because all text fields are blank. I tested this by adding a hidden id and that showed me that form 1 is submitted even if I click to submit for 2 or 3.</p>

<p>Below is what my code looks like on the page: You can also test it here:
<a href="http://www.sports-markedet.no/garasjesalg/" rel="nofollow">http://www.sports-markedet.no/garasjesalg/</a></p>

<p>If going to my site you will see 3 ads, click the <code>Kontakt selger</code> link on the above ad and you will get a popup to fill in information, this works OK. Then if you do the same in the next ad you will get a validation issue, this is because the form from first ad is used. Code from source code pasted below:</p>

<pre><code>&lt;style type="text/css"&gt;
#PopupContact_BoxContainerAd_3 {
    height:350px;
    width:390px;
    background:#FFFFFF;
    border:1px solid #000;
    padding:0;
    position:absolute;
    z-index:999;
    cursor:default;   
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    -khtml-border-radius: 10px;
    border-radius: 10px;   
    display:none;
}
&lt;/style&gt;

&lt;div style="display: none;" id="PopupContact_BoxContainerAd_3"&gt;
  &lt;div id="PopupContact_BoxContainerHeader"&gt;
    &lt;div id="PopupContact_BoxTitle"&gt;Kontakt selgeren&lt;/div&gt;
    &lt;div id="PopupContact_BoxClose"&gt;&lt;a href="javascript:PopupContact_HideForm('PopupContact_BoxContainerAd_3','PopupContact_BoxContainerFooter');"&gt;Lukk&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="PopupContact_BoxContainerBody"&gt;
    &lt;form enctype="multipart/form-data" action="#" name="PopupContact_FormAd_3" id="PopupContact_FormAd_3"&gt;
      &lt;div id="PopupContact_BoxAlert"&gt; &lt;span id="PopupContact_alertmessage"&gt;&lt;/span&gt; &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt; Ditt navn &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;input name="PopupContact_name" class="PopupContact_TextBox" type="text" id="PopupContact_name" maxlength="120"&gt;
      &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt; Din e-postadresse &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;input name="PopupContact_email" class="PopupContact_TextBox" type="text" id="PopupContact_email" maxlength="120"&gt;
      &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt; Skriv inn en melding til selgeren &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;textarea name="PopupContact_message" class="PopupContact_TextArea" rows="3" id="PopupContact_message"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;input type="hidden" name="ad_id" id="ad_id" value="3"&gt;&lt;input type="button" name="buttonAd_3" class="PopupContact_Button" value="Send forespørsel" onClick="javascript:PopupContact_Submit(this.parentNode,'http://www.sports-markedet.no/wp-content/plugins/garagesale/');"&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style="display: none;" id="PopupContact_BoxContainerFooter"&gt;&lt;/div&gt;


&lt;style type="text/css"&gt;
#PopupContact_BoxContainerAd_2 {
    height:350px;
    width:390px;
    background:#FFFFFF;
    border:1px solid #000;
    padding:0;
    position:absolute;
    z-index:999;
    cursor:default;   
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    -khtml-border-radius: 10px;
    border-radius: 10px;   
    display:none;
}
&lt;/style&gt;

&lt;div style="display: none;" id="PopupContact_BoxContainerAd_2"&gt;
  &lt;div id="PopupContact_BoxContainerHeader"&gt;
    &lt;div id="PopupContact_BoxTitle"&gt;Kontakt selgeren&lt;/div&gt;
    &lt;div id="PopupContact_BoxClose"&gt;&lt;a href="javascript:PopupContact_HideForm('PopupContact_BoxContainerAd_2','PopupContact_BoxContainerFooter');"&gt;Lukk&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="PopupContact_BoxContainerBody"&gt;
    &lt;form enctype="multipart/form-data" action="#" name="PopupContact_FormAd_2" id="PopupContact_FormAd_2"&gt;
      &lt;div id="PopupContact_BoxAlert"&gt; &lt;span id="PopupContact_alertmessage"&gt;&lt;/span&gt; &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt; Ditt navn &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;input name="PopupContact_name" class="PopupContact_TextBox" type="text" id="PopupContact_name" maxlength="120"&gt;
      &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt; Din e-postadresse &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;input name="PopupContact_email" class="PopupContact_TextBox" type="text" id="PopupContact_email" maxlength="120"&gt;
      &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt; Skriv inn en melding til selgeren &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;textarea name="PopupContact_message" class="PopupContact_TextArea" rows="3" id="PopupContact_message"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;input type="hidden" name="ad_id" id="ad_id" value="2"&gt;&lt;input type="button" name="buttonAd_2" class="PopupContact_Button" value="Send forespørsel" onClick="javascript:PopupContact_Submit(this.parentNode,'http://www.sports-markedet.no/wp-content/plugins/garagesale/');"&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style="display: none;" id="PopupContact_BoxContainerFooter"&gt;&lt;/div&gt;


&lt;style type="text/css"&gt;
#PopupContact_BoxContainerAd_1 {
    height:350px;
    width:390px;
    background:#FFFFFF;
    border:1px solid #000;
    padding:0;
    position:absolute;
    z-index:999;
    cursor:default;   
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    -khtml-border-radius: 10px;
    border-radius: 10px;   
    display:none;
}
&lt;/style&gt;

&lt;div style="display: none;" id="PopupContact_BoxContainerAd_1"&gt;
  &lt;div id="PopupContact_BoxContainerHeader"&gt;
    &lt;div id="PopupContact_BoxTitle"&gt;Kontakt selgeren&lt;/div&gt;
    &lt;div id="PopupContact_BoxClose"&gt;&lt;a href="javascript:PopupContact_HideForm('PopupContact_BoxContainerAd_1','PopupContact_BoxContainerFooter');"&gt;Lukk&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="PopupContact_BoxContainerBody"&gt;
    &lt;form enctype="multipart/form-data" action="#" name="PopupContact_FormAd_1" id="PopupContact_FormAd_1"&gt;
      &lt;div id="PopupContact_BoxAlert"&gt; &lt;span id="PopupContact_alertmessage"&gt;&lt;/span&gt; &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt; Ditt navn &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;input name="PopupContact_name" class="PopupContact_TextBox" type="text" id="PopupContact_name" maxlength="120"&gt;
      &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt; Din e-postadresse &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;input name="PopupContact_email" class="PopupContact_TextBox" type="text" id="PopupContact_email" maxlength="120"&gt;
      &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt; Skriv inn en melding til selgeren &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;textarea name="PopupContact_message" class="PopupContact_TextArea" rows="3" id="PopupContact_message"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div id="PopupContact_BoxLabel"&gt;
        &lt;input type="hidden" name="ad_id" id="ad_id" value="1"&gt;&lt;input type="button" name="buttonAd_1" class="PopupContact_Button" value="Send forespørsel" onClick="javascript:PopupContact_Submit(this.parentNode,'http://www.sports-markedet.no/wp-content/plugins/garagesale/');"&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div style="display: none;" id="PopupContact_BoxContainerFooter"&gt;&lt;/div&gt;
</code></pre>
