View Single Post
  #19  
Old 06-05-2004, 04:23 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default

Many thanks Adian009

Code:
if (product_option('Product Option').value == '') { alert('You must enter an option'); return false; } else {return true;}

You can still bypass it, by pressing Enter in the product option field, so I disabled the Enter key...

Add this script to the top of skin1/customer/main/product.tpl

Code:
{literal} <script type="text/javascript"> function handleEnter (field, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { var i; for (i = 0; i < field.form.elements.length; i++) if (field == field.form.elements[i]) break; i = (i + 1) % field.form.elements.length; field.form.elements[i].focus(); return false; } else return true; } </script> {/literal}

then find
/skin1/modules/Product_Options/customer_options.tpl

change
Code:
<input type=text name="product_options[{$product_options[product_option].optclass}]" size=12>

to

Code:
<input type=text name="product_options[{$product_options[product_option].optclass}]" onkeypress="return handleEnter(this, event)" size=12>
Reply With Quote