Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

multiple dropdowns causing problems on new version


sackling

Recommended Posts

Hello all,

 

I am in the process of updating from 2.2 to 2.3.1.

 

Everyhting is working except for one thing. On some products I have multiple drop downs. They are supposed to be one or the other. the way I had this setup was by including this in the html_output.php:

 

$field .= '<option value="9999">Please Select</option>';

 

and then this javascript on the product_info.php:

 

<script type="text/javascript"><!--
function validate(cart_quantity) 
{
   var sel3 = cart_quantity.elements['id[3]'];
   var sel2 = cart_quantity.elements['id[2]'];
   var selonly = ( sel3 == null ) ? sel2 : ( sel2 == null ) ? sel3 : null;
   if ( selonly != null )
   {
       if ( selonly.selectedIndex == 0 )
       {
           alert("Please select an option");
           selonly.focus();
           return false;
       }
       return true;
   }
   if  ( (sel2.selectedIndex == 0) ^ (sel3.selectedIndex ==  0 ) ) return true;
   alert('Please select only one option');
cart_quantity.elements['id[2]'].value = 9999;
cart_quantity.elements['id[3]'].value = 9999;
   sel2.focus();
   return false;
}
//--></script>

 

For some reason now on the new version when I try to add the product to the cart and select just one of the options it won't add to the cart. it will just advance to the shopping cart with nothing in it. This only happens on the items that have 2 dropdowns that are mutually exclusive.

 

Any ideas on what I can do to fix this?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...