View Single Post
  #6  
Old 03-23-2010, 11:39 AM
  Yalokin's Avatar 
Yalokin Yalokin is offline
 

Advanced Member
  
Join Date: Sep 2009
Location: New York USA
Posts: 75
 

Default Re: Make Text Option a Required Field

Ok, Thank you.

I did somethink like this before:

var obj = product_option("Line1"); if(obj.value.length<1) { alert("'Line1' Length is '"+obj.value.length+"' Text Lines fields can not be empty''"); obj.focus(); return false; } return true;

But we have hundreds of products what might require same validation of more then in text line.
Some thing like: Line1, Line2, Line3...

In additon if you try to add our product to shopping cart and them edit (in cart.php) page x-cart open pop-up and above validation script not working.

Did anyone tried it before in cart.php page.

thank you.


Quote:
Originally Posted by Warwick
something else that seems to work (4.2.x)
Code:
if (product_option('Name of your text option').value == '') { alert('Alert you want to show'); return false; } else return true;
__________________
Reply With Quote