?
Solved

Issues with HTML forms - two forms on one page

Posted on 2007-07-21
4
Medium Priority
?
672 Views
Last Modified: 2007-12-19
I am hoping someone can help me with the following code problem. I have a page that has several form functions on it, among them 1. add to cart and 2. write customer review. The customer review part is split into two possibilities: a. No one has left a review yet. In this case, the text "Write a Review" appears and links to the submit form. b. If reviews have already been submitted, you also can see these reviews, including a star rating that is based on user input.

I have all the code, but it's not working. I can get the add to cart to work or the write a review, but for some reason not both together. I'm really not experienced with forms, so I think I may just have the tags in the wrong place. Any help would be much appreciated!!!

My code is the following:

<script language="JavaScript" src="assets/templates/common/js/listing.js" type="text/JavaScript"></script>
<script language="JavaScript">
<!--
//thumbnail script
image1 =new Image();
image2 =new Image();
image3 =new Image();
image4 =new Image();

// This defines the source of the display image
image1.src ="[image1]";
image2.src ="[image2]";
image3.src ="[image3]";
image4.src ="[image4]";
imagecaption1="[imagecaption1]";
imagecaption2="[imagecaption2]";
imagecaption3="[imagecaption3]";
imagecaption4="[imagecaption4]";


// This defines what to do when an image is clicked on
function image_click(clicks)
{
if(clicks==1)
{document.getElementById('large').src=image1.src;changecontent("imagecaptiont",imagecaption1);}

if(clicks==2)
{document.getElementById('large').src=image2.src;changecontent("imagecaptiont",imagecaption2);}

if(clicks==3)
{document.getElementById('large').src=image3.src;changecontent("imagecaptiont",imagecaption3);}

if(clicks==4)
{document.getElementById('large').src=image4.src;changecontent("imagecaptiont",imagecaption4);}



}


function check_stock(what,partnum)
{
var soption;
var i;
var backordermode=[allowbackorder];
var avail_instock='[product_Availability-Instock]';
var avail_outofstock='[product_Availability-Outofstock]';
var avail_backorder='[product_Availability-Backorder]';



for(i=0;i<inventoryarray[catalogid].length;i++) {
      soption=inventoryarray[catalogid][i];
      field_array=soption.split("-");
      if ((field_array[0]==partnum) && ((eval(GetValue(what,"qty-0")))>(field_array[1])))
      {

      if (backordermode==1)
      {changecontent("availability",avail_backorder); return true;}
      else {
      changecontent("availability",avail_outofstock);
      alert("The options you selected are not currently available.");
      return false;
      }
      }

    }


changecontent("availability",avail_instock);
return true;
}


function check_and_add(formx)
{

if (document.add.std_price==null)
{
document.add.submit();
}
else
{
var readytoadd=validateValues(formx,1)
if (readytoadd==true)
{
document.add.submit();
}
}
}

// --></script>
<link type="text/css" rel="stylesheet" href="css/default.css" />
<style type="text/css">
<!--
.style1 {
      font-family: Georgia, "Times New Roman", Times, serif;
      font-size: 14px;
}

li {
margin: 0 0px; padding: 0;
}


-->
</style>

  <form ENCTYPE="multipart/form-data" method=post action=add_cart.asp name="add">

  <input type=hidden name=item_id value=[catalogid] />                            
  <input type=hidden name=category_id value=[catid] />
  <table width="100%" cellpadding="0" cellspacing="0">
<tr><td colspan="3">
<!--START: CATEGORY_FULLINE-->
  <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
            <td>
                  <div align=left class="font2">
                  [CATEGORY_FULLLINE]
                  </div>
            </td>
    </tr>
  </table>
 <!--END: CATEGORY_FULLINE-->

</td></tr>

<tr><td colspan="3">
<table width="100%" cellpadding="5" cellspacing="0" border="0">
<tr>
<td valign="top" width="25%">
<!--start img block-->
<table width="100%" cellpadding="0" cellspacing="0">

<tr><td align="center" style="padding-top:6px;"> <!--START: image1-->
                                <a href="#" onClick="popupsimple('zoomify.asp?catalogid=[catalogid]&image=' + document.large.src,500,500);"><img src="[image1]" alt="[name]" name="large" width="150" border="0" align="middle" id="large" style="border: 1px solid #f9e7bf;" /></a><br />
                                <span name="imagecaptiont" class="font1" id="imagecaptiont">[imagecaption1]</span><br />
                                <!--END: image1--></td>
</tr>
<tr><td align="center">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                    <tr>
                                    <!--START: image2-->


                        <td  align="center" class="price-info">
                              <a href="#" onclick="javascript:image_click(1);return false;"><img border=0 src="[image1]" width="50" name="pimage1" /></a>
                                  </td>

                                     <td  align="center" class="price-info">
                              <a href="#" onclick="javascript:image_click(2);return false;"><img border=0 src="[image2]" width="50" name="pimage2" /></a>
                                  </td>



                                    <!--END: image2-->

                                    <!--START: image3-->
                                     <td  align="center" class="price-info">
                              <a href="#" onclick="javascript:image_click(3);return false;"><img border=0 src="[image3]" width="50" name="pimage3" /></a>
                                  </td>
                                    <!--END: image3-->

                                    <!--START: image4-->
                                     <td  align="center" class="price-info">
                              <a href="#" onclick="javascript:image_click(4);return false;"><img border=0 src="[image4]" width="50" name="pimage4" /></a>
                                  </td>
                                    <!--END: image4-->


                            </tr>

                            <!--START: image5-->
                              <tr><td colspan="4" align="right">
                              <a href="#" onClick="popupsimple('gallery.asp?catalogid=[catalogid]',550,460)" name="IMG"><img src="assets/templates/default/images/additionalimages.jpg" border="0" width="122" height="27" /></a>
                              </td></tr>
                              <!--END: image5-->
                  </table>
</td></tr>
</table>
<!--end img block-->
</td>

<td valign="top" width="75%">
 <table width="100%" cellspacing="2" cellpadding="0" border="0">
<tr>
<td height="30" colspan="3" background="assets/templates/default/images/name_bg.jpg" class="font4" style="padding-top:8px; color:#955c02;">&nbsp;&nbsp;&nbsp;<b>[name]</b></td>
</tr>
<tr>
  <td><table width="95%">
    <tr>
      <!--START: product_availability-->
      <td width="70" class="price-info"><b>[product_Header-availability]&nbsp;</b></td>
      <td class="price-info"><div id="availability">[availability]</div></td>
      <!--END: product_availability-->
    </tr>
    <tr>
      <td class="price-info">&nbsp;</td>
      <!--START: freeshippingblock-->
      <td class="price-info">[freeshipping]</td>
      <!--END: freeshippingblock-->
    </tr>
  </table>
    <table cellspacing="4" cellpadding="0" border="0">
      <!--START: price2-->
      <tr>
        <td align="left" class="price-info"><strong>[product_retailprice]</strong></td>
        <td align="left" class="price"><div align="right">[price2]</div></td>
      </tr>
      <!--START: SAVINGS-->
      <!--END: SAVINGS-->
      <!--END: price2-->
      <tr>
        <td align="left" class="price-info" valign="top"><strong>[product_yourprice]</strong></td>
        <td class="price" align="left"><!--START: ITEMPRICE-->
            <div id="price">
              <div align="right" style="color: #006600">[price]</div>
            </div>
            <div align="right" style="color: #006600">
              <!--END: ITEMPRICE-->
              <!--START: SALEPRICE-->
              <s>[price]</s> </div>
            <div id="price">
              <div align="right" style="color: #006600">[saleprice]</div>
            </div>
            <div align="right">
              <!--END: SALEPRICE-->
          </div></td>
      </tr>
      <tr>
        <td align="left" class="price-info"><strong>[product_savings]</strong></td>
        <td align="left" class="price" style="color: #ea1a01"><div align="right">- [savings]</div></td>
      </tr>
    </table></td>
  <td><table>
    <tr>
      <td align="left" class="price-info"><strong>[product_quantity]</strong></td>
    </tr>
    <tr>
      <td align="left" width="70" class="price-info"><!--START: qtybox-->
          <input type="text" size=3 name="qty-0" value=1 onChange="validateValues(document.add,1);" class="txtBoxStyle" />
          <!--END: qtybox--></td>
    </tr>
    <tr>
      <td width="50" align="center" class="price-info"><br />
          <input type="button" onClick="check_and_add(document.add);" name="Add" value="[product_addtocart]" class="btn" /></td>
    </tr>
  </table></td>
  <td><table width="100%" cellpadding="1" cellspacing="0" border="0">
  <td class="font4"></td>
  </tr>

  <tr>
    <td class="font4" colspan=2><a href="#writeareview">View All Reviews</a> </td>
  </tr>
  <tr>
    <td class="font4" colspan=2><a href="#writeareview">Write A Review </a></td>
  </tr>
  <tr>
    <td class="font4" colspan=2><!--START: email_friend-->
        <a href="#" onClick="javascript:window.open('recommendafriend.asp?url=[friendurl]','popup','height=350,width=500,location=no,' + 'scrollbars=no,menubars=no,toolbars=no,resizable=yes');"><br />
      [product_emailtofriend]</a>
        <!--END: email_friend--></td>
  </tr>
  <tr>
                  <td class="font4"> <a href="German-Wine-Food-Pairing_ep_48-1.html"><strong>German Wine
                    &amp; Food Pairing Chart</strong></a> </td>
  </tr>
  </table></td>
</tr>
<tr>
<!--START: quantity-->
  <td colspan="3"><table width="60%" border="0" cellspacing="2" cols="3">
    <tr>
      <td colspan="5" class="price-info" ><strong>[product_Header-quantitypricing]</strong></td>
    </tr><tr>
      <td><span class="font4"><strong>[product_quantitypricing-quantity]</strong></span></td>
      <td><span class="font4"><strong>[product_quantitypricing-price]</strong></span></td>
      <!--START: quantity_items-->
    </tr><tr>
      <td class="price-info">[LOW]-[HIGH]</td>
      <td class="price-info">$[PRICE]</td>
     
    </tr>
    <!--END: quantity_items-->
  </table>
  <!--END: quantity-->
    <table width="100%" border="0" cellspacing="2" cols="3"><tr>
    <td valign="top"><table bgcolor="#f8e9c0" width="100%" align="center" cellpadding="5" cellspacing="0" border="0" id="Table1">
        <tr>
          <td class="font4" height="30" background="assets/templates/default/images/name_bg.jpg" style="padding-top:8px; color:#802e16; font-size:12px"><b>[extra_field_1]</b> </td>
        </tr>
        <tr>
          <td class="font4" style="color:#802e16; font-size:12px;"><table bgcolor="#f8e9c0" width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
              <tr>
                <td class="font4"; style="color:#802e16; line-height:16px"><!--START: PRODUCT_FEATURES-->
                    <li>[product_feature_name]</li>
                    <!--END: PRODUCT_FEATURES-->
                </td>
              </tr><tr>
                <td colspan="3"><!--START: extrafields-->
                    <!--START: extra_field_2-->
                    <br />
                    <div class="item"><b>[product_extrafield2]</b> [extra_field_2]</div>
                    <!--END: extra_field_2-->
                    <!--START: extra_field_3-->
                    <br />
                    <div class="item"><b>[product_extrafield3]</b> [extra_field_3]</div>
                    <!--END: extra_field_3-->
                    <!--START: extra_field_4-->
                    <br />
                    <div class="item"><b>[product_extrafield4]</b> [extra_field_4]</div>
                    <!--END: extra_field_4-->
                    <!--START: extra_field_5-->
                    <br />
                    <div class="item"><b>[product_extrafield5]</b> [extra_field_5]</div>
                    <!--END: extra_field_5-->
                    <p>
                      <!--START: extra_field_6-->
                    </p><table width="100%" cellpadding="0" cellspacing="0" border="0">
                      <tr>
                        <td class="titles" >&nbsp;[product_extrafield6]</td>
                      </tr>
                      <tr>
                        <td colspan="2"><img src="spacer.gif" width="1" height="5" alt="" border="0" /></td>
                      </tr>
                      <tr>
                        <td class="item" colspan="2">[extra_field_6]</td>
                      </tr>
                    </table>
                    <!--END: extra_field_6-->
                    <!--START: extra_field_7-->
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                      <tr>
                        <td class="titles" >&nbsp;[product_extrafield7]</td>
                      </tr>
                      <tr>
                        <td colspan="2"><img src="spacer.gif" width="1" height="5" alt="" border="0" /></td>
                      </tr>
                      <tr>
                        <td class="item" colspan="2">[extra_field_7]</td>
                      </tr>
                    </table>
                    <!--END: extra_field_7-->
                    <!--START: extra_field_8-->
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                      <tr>
                        <td class="titles" >&nbsp;[product_extrafield8]</td>
                      </tr>
                      <tr>
                        <td colspan="2"><img src="spacer.gif" width="1" height="5" alt="" border="0" /></td>
                      </tr>
                      <tr>
                        <td class="item" colspan="2">[extra_field_8]</td>
                      </tr>
                    </table>
                    <!--END: extra_field_8-->
                    <!--START: extra_field_9-->
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                      <tr>
                        <td class="titles" >&nbsp;[product_extrafield9]</td>
                      </tr>
                      <tr>
                        <td colspan="2"><img src="spacer.gif" width="1" height="5" alt="" border="0" /></td>
                      </tr>
                      <tr>
                        <td class="item" colspan="2">[extra_field_9]</td>
                      </tr>
                    </table>
                    <!--END: extra_field_9-->
                    <!--START: extra_field_10-->
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                      <tr>
                        <td class="titles" >&nbsp;[product_extrafield10]</td>
                      </tr>
                      <tr>
                        <td colspan="2"><img src="spacer.gif" width="1" height="5" alt="" border="0" /></td>
                      </tr>
                      <tr>
                        <td class="item" colspan="2">[extra_field_10]</td>
                      </tr>
                    </table>
                    <!--END: extra_field_10-->
                    <!--END: extrafields-->
                </td>
              </tr>
          </table></td>
        </tr>
    </table></td>
    </tr></table></td>
  </tr>
 </table>

<!--START: quantity--></td>
  </tr>
        <td>        
       
    </td></tr>
      
<!--END: pricing-->
<tr>
<td colspan="2"><table width="100%" cellpadding="0" cellspacing="5" border="0">
  <!-- <tr>
                                      <td class="titles" >&nbsp;[product_Header-description]</td>
                                </tr>-->
  <tr>
  <td height="30" background="assets/templates/default/images/name_bg.jpg" class="font4" style="padding-top:8px;color:#955c02;">&nbsp;&nbsp;&nbsp;<strong>Wine Description
  </strong></td>
  </tr>
  <tr>
    <td class="text" colspan="2"><div align="justify">[extended_description]</div></td>
  </tr>
</table></td>
</tr>
<tr>
  <td colspan="2"><table width="100%" cellpadding="0" cellspacing="5" border="0" align="center">
    <tr>
      <td colspan="6" height="30" background="assets/templates/default/images/name_bg.jpg" style="padding-top:8px;color:#955c02;" class="font4">&nbsp;&nbsp;&nbsp;<b>[product_Header-relateditems]</b></td>
    </tr>
    <tr>
      <td colspan="6" height="5"><img src="assets/templates/common/images/spacer.gif" height="5" /></td>
    </tr>
    <!--START: related_items0-->
    <table width=98% cellspacing="0" cellpadding="0" border="0">
      <tr>
        <td align=center><table border="0" cellspacing="0" cellpadding="5" width=100% align=center>
            <tr>
              <td><table border="0" cellspacing="0" cellpadding="3" width="100%" style="border: 1px solid #f0d393;" bgcolor="#ffffff">
                  <tr valign="middle">
                    <td colspan="2" class="item" align="center"><a href="product.asp?itemid=[catalogid]" style="font-weight:bold;important">[name]</a></td>
                  </tr>
                  <tr>
                    <td rowspan="6"  valign="middle" height="100"><a href="product.asp?itemid=[catalogid]"><img src="[THUMBNAIL]" width="70" alt="" border="0" /></a></td>
                  </tr>
                  <tr>
                    <td class="font1" style="color: #ea1a01;"  valign="top" colspan="2"><!--START: ITEMPRICE-->
                    [product_yourprice] [ITEMPRICE]
                      <!--END: ITEMPRICE-->
                      <!--START: SALEPRICE-->
                    [product_retailprice]<s>[ITEMPRICE]</s><br />
                    [product_yourprice] [ITEMSALEPRICE]
                    <!--END: SALEPRICE--></td>
                  </tr>
                  <!--START: product_availability-->
                  <tr>
                    <td class="font1" style="color: #d29e26;">[product_Header-availability] [availability]</td>
                  </tr>
                  <!--END: product_availability-->
                  <tr>
                    <td class="font1">[description]</td>
                  </tr>
                  <tr>
                    <td height="20" class="item" valign="top"><a href="add_cart.asp?quick=1&item_id=[catalogid]"><img border="0" src="assets/templates/default/images/addtocart.jpg" /></a></td>
                  </tr>
              </table></td>
            </tr>
        </table></td>
      </tr>
    </table>
    <!--END: related_items0-->
    <!--START: related_items1-->
    <table border="0" cellspacing="0" cellpadding="0" width="95%">
      <tr>
        <td colspan="2" align="center" valign="middle"><a href="product.asp?itemid=[catalogid]"><img src="[THUMBNAIL]" alt="" border="0" /></a> </td>
      </tr>
      <tr valign="middle">
        <td colspan="2" class="item" align="center">[name]</td>
      </tr>
      <tr>
        <td class="price" align="center" valign="middle" colspan="2"><!--START: ITEMPRICE-->
        [ITEMPRICE]
          <!--END: ITEMPRICE-->
          <!--START: SALEPRICE-->
          <s>[ITEMPRICE]</s><br />
          [ITEMSALEPRICE]
          <!--END: SALEPRICE-->
        </td>
      </tr>
    <td class="item" colspan="2" align="center" valign="middle"><input type=checkbox name="item_id" value="[catalogid]" />
            <input type="hidden" name="qty-[counter]" value=1 /></td>
    </tr>
    </table>
    <!--END: related_items1-->
    <!--START: related_items2-->
    <table border="0" cellspacing="0" cellpadding="0" width="95%">
      <tr>
        <td class="item" align="left" width="50%"><a href="product.asp?itemid=[catalogid]">[name]</a></td>
        <td class="price" align="center" valign="middle" width="20%"><!--START: ITEMPRICE-->
        [ITEMPRICE]
          <!--END: ITEMPRICE-->
          <!--START: SALEPRICE-->
          <s>[ITEMPRICE]</s><br />
          [ITEMSALEPRICE]
          <!--END: SALEPRICE-->
        </td>
        <td class="item"  align="center" valign="middle" width="30%">&nbsp;&nbsp;
            <input type=hidden name="item_id" value="[catalogid]" />
            <input type="text" size="2" name="qty-[counter]" value=0 /></td>
      </tr>
    </table>
    <!--END: related_items2-->
  </table>
    <TABLE style="BACKGROUND-IMAGE: url(assets/templates/default/images/listing_top_bg.jpg); BACKGROUND-REPEAT: no-repeat" cellSpacing=0 cellPadding=10 width=99% align=center border=0>
      <TBODY>
        <TR>
          <TD height=120><TABLE cellSpacing=0 cellPadding=5 border=0>
              <TBODY>
                <TR>
                  <TD><a href="Barth_ep_29-1.html"><img src="assets/images/barth/norbertandmarion.jpg" alt="Barth Wine - Rheingau" width="100" height="81" border="0" /></a></TD>
                  <TD class="text"><p align="justify"><span class="style1">The Barth estate is located in famous Hattenheim, overlooking the Rhine near some of the areas best sites, including Wisselbrunnen, Sch&uuml;tzenhaus and Hassel. The winery is a young and dynamic family-owned company, founded in 1948.</span> <A style="FONT-SIZE: 12px; FONT-FAMILY: Arial, Helvetica, sans-serif" href="Barth_ep_29-1.html">Barth Winery Profile</A> </p></TD>
                </TR>
              </TBODY>
          </TABLE></TD>
        </TR>
      </TBODY>
    </TABLE></td>
</tr>
<tr><td colspan="3">
       <!--START: reviews--><a name="writeareview"></a>
                               <p>
          </p><table width="100%" cellpadding="1" cellspacing="1" border="0" >
                                        <tr>
                                            <td class="font1" colspan=2><b>[reviews_total] [totalrating]</b></td>
                                          <td colspan=2 class="font1" align=right>[review_link]</td>
            </tr>
                                         <tr>
                                          <td colspan="4" class="titles" >&nbsp;[reviews_header]</td>
                                        </tr>
                                          <!--START: user_reviews-->
                                          <tr>
                                          <td class="font1" width=80 align=left><b><img src="assets/templates/common/images/star[rating].gif" /></b></td>
                                          <td class="font1">[short_review]</td>
                                          <td class="font1">&nbsp;</td>
                                          <td class="font1" align=right></td>
            </tr>
                                         <tr>
                                          <td class="font1" width=80>Reviewed by:</td>
                                          <td class="font1" colspan=3 align=left><b>[user_name]</b> from [user_city].<!--START: user_email--> <a href="mailto:[user_email]">[user_email]</a><!--END: user_email--></td>
                                         </tr>
                                         <tr>
                                          <td class="font1" colspan=4>[long_review]</td>
                                         </tr>

                                           <!--END: user_reviews-->

                                      </table>
                                    <!--START: create_review_link--><a href='product.asp?itemid=[itemid]&action=all'>[reviews_new]</a><!--END: create_review_link-->
                             <!--END: reviews-->
                              <br>
                        <!--START: create_first_review--><a href='product.asp?itemid=[itemid]&action=all'>[reviews_first]</a><!--END: create_first_review-->

                              <!--START: create_review-->
                               <p>&nbsp; <br>
                               </p><form name=creview method=post action="review.asp?action=create&amp;catalogid=[catalogid]">
                                      <table width="100%" cellpadding="2" cellspacing="0" border="0" ID="Table1">
                                        <tr>
                                          <td colspan="4" class="titles" >&nbsp;[reviews_add]</td>
                                        </tr>
                                         <tr>
                                          <td width="11%" class="price-info">Name: </td>
                                          <td width="41%" class="price-info"><input type=text name=user_name ID="Text2" maxlength=50 class="txtBoxStyle" />&nbsp;<img src="assets/templates/common/images/error2.gif" width="12" height="12" /></td>
                                          <td width="6%" class="price-info">Email: </td>
                                          <td width="42%" class="price-info"><input type=text name=user_email ID="Text3" maxlength=50 class="txtBoxStyle" />&nbsp;<img src="assets/templates/common/images/error2.gif" width="12" height="12" /></td>
                                         </tr>
                                           <TR>
                                          <td class="price-info">Location: </td>
                                          <td class="price-info" colspan=3><input type=text size=58 name=user_city ID="Text1" maxlength=50 class="txtBoxStyle" />&nbsp;<img src="assets/templates/common/images/error2.gif" width="12" height="12" /></td></TR>
                                        <tr><td class="price-info">Title:</td>
                                         <td class="price-info" colspan=3 align=center>
                                          <P align=left><input type=text size=58 name=short_review maxlength=100 ID="Text4" class="txtBoxStyle" />&nbsp;<img src="assets/templates/common/images/error2.gif" width="12" height="12" /></P></td>
                                          </tr><tr>
                                         </tr><tr>
                                          <td class="price-info">Review:</td><td  colspan=3><textarea cols=44 name=long_review class="txtareaStyle"></textarea>&nbsp;<img src="assets/templates/common/images/error2.gif" width="12" height="12" /></td>
                                         </tr>
                                         <tr><td class="price-info">Rating:</td>
                                         <td class="price-info" colspan=3 align=center>
                                        <input type=radio name=rating value=1 /> <img src="assets/templates/common/images/star1.gif" />
                                        <input type=radio name=rating value=2 ID="Radio1" /> <img src="assets/templates/common/images/star2.gif" />&nbsp;

                                         <input type=radio name=rating value=3 ID="Radio2" /><img src="assets/templates/common/images/star3.gif" />&nbsp;
                                         <input type=radio name=rating value=4 ID="Radio3" /><img src="assets/templates/common/images/star4.gif" />&nbsp;
                                         <input type=radio name=rating value=5 ID="Radio4" checked /><img src="assets/templates/common/images/star5.gif" />&nbsp;
                                         </td></tr>
                                          <tr><td class="price-info" colspan=4 align=center><input type=submit value="Add Review" class="btn" /></td></tr>

                                            <tr><td colspan="4"><span class="error"><img src="assets/templates/common/images/error2.gif" /> = Required</span></td></tr>

                                      </table>
                                </form>

<script language="JavaScript" type="text/javascript">
//You should create the validator only after the definition of the HTML form
  var frmvalidator  = new Validator("creview");

  frmvalidator.setAddnlValidationFunction("submitForm");



  frmvalidator.addValidation("user_name","req","Please enter your First and Last Name.");
  frmvalidator.addValidation("user_name","maxlen=40","Max length for Name is 40.");


  frmvalidator.addValidation("user_city","req","Please enter your City.");
  frmvalidator.addValidation("user_city","maxlen=50","Max length for City is 50.");



  frmvalidator.addValidation("user_email","maxlen=50","Max length for Email is 50.");
frmvalidator.addValidation("user_email","email");
frmvalidator.addValidation("user_email","req","Please enter your E-mail.");


  frmvalidator.addValidation("long_review","maxlen=500","Max length for Name is 500.");
  frmvalidator.addValidation("long_review","req","Please enter your review.");

  frmvalidator.addValidation("short_review","maxlen=100");
  frmvalidator.addValidation("short_review","req","Please enter your review.");





</script>

                             <!--END: create_review-->


</td></tr>
</table>

<script language="JavaScript" type="text/javascript">
//You should create the validator only after the definition of the HTML form
  var frmvalidator  = new Validator("creview");

  frmvalidator.setAddnlValidationFunction("submitForm");



  frmvalidator.addValidation("user_name","req","Please enter your First and Last Name.");
  frmvalidator.addValidation("user_name","maxlen=40","Max length for Name is 40.");


  frmvalidator.addValidation("user_city","req","Please enter your City.");
  frmvalidator.addValidation("user_city","maxlen=50","Max length for City is 50.");



  frmvalidator.addValidation("user_email","maxlen=50","Max length for Email is 50.");
frmvalidator.addValidation("user_email","email");
frmvalidator.addValidation("user_email","req","Please enter your E-mail.");


  frmvalidator.addValidation("long_review","maxlen=500","Max length for Name is 500.");
  frmvalidator.addValidation("long_review","req","Please enter your review.");

  frmvalidator.addValidation("short_review","maxlen=100");
  frmvalidator.addValidation("short_review","req","Please enter your review.");

</script>
                             <!--END: create_review-->



 <!--START: CATEGORY_HEADER-->

 <!--END: CATEGORY_HEADER-->


 
<!--START: CATEGORY_FOOTER-->
              <table width="95%" cellspacing="0" cellpadding="2" border="0">
                <tr>
                        <td  class="font2">[CONTENT]</td>
                </tr>
              </table>
             <!--END: CATEGORY_FOOTER-->




      <script language="javascript">
                        validateValues(document.add,0);
                        </script>
0
Comment
Question by:sabribo
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19538908
1. what is it supposed to do, what does it do
2. a url is better than a busload of html

Perhaps you can make a mockup and tell us exactly what you click and what does not happen

3. 50 points?

Michel
0
 

Author Comment

by:sabribo
ID: 19540271
Sorry about the points - as you can tell I am new to this... I hope the increase works out better.

The reason I posted all the code is that I am not sure where the actual problem is. You can go to the following page to see what it's supposed to look like: http://www.trulyfinewine.com/2005-Barth-Oestricher-Riesling--Semi-Dry_p_16-6.html.

Basically, the page needs to do the following:

1. If you click on "Add To Cart", the product gets added to the shopping cart in the quantities specified. This is the first form and is currently working. There are also the related items below, which are supposed to perform the same function.

(The "View All Reviews" and "Write A Review" links to the right of the add to cart button are currently just hyperlinks that are anchored to the review section at the bottom of the page. )

2. If you go to the bottom of the page, you can select "Write a Review", which opens the form where you can enter the review (below the comments that are already there). When you click "Add Review", it's supposed to submit the review and list it with the others above (and adjust the star rating if necessary.) Here is where the problem starts, because right now when you click this button, it performs the "Add to Cart" action. That's why I'm assuming that the first form isn't closed properly or that there is something wrong with the placement of the tags.

3. Alternatively, if there hasn't been a review placed yet, you will see "Be the first to review this item" instead of the "Write a Review" link. You can see this under the following url: http://www.trulyfinewine.com/2005-Barth-Riesling-Auslese--Sweet_p_16-59.html. This would open the same review submit form as described above. The same thing happens here - the item gets added to the cart instead of the review submitted.

Thanks for your help!

0
 
LVL 17

Accepted Solution

by:
jasonsbytes earned 800 total points
ID: 19541529
the first form tag isn't closed at all:
<form ENCTYPE="multipart/form-data" method=post action=add_cart.asp name="add">

You need to locate the point where this form ends and add:
</form>

Make sure it happens before the opening tag of the second form here:
</p><form name=creview method=post action="review.asp?action=create&amp;catalogid=[catalogid]">


0
 

Author Comment

by:sabribo
ID: 19553236
Thanks much! I think I did not have two forms separated correctly before... Makes perfect sense now!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question