---- dataentry snippet ---- type : snippet # do not change this line category : Add to cart form # mention the category like 'shipping', 'checkout' etc name : Add To Cart Form Field Validation # the name of the snippet description : Validate form fields before adding a product to the cart # description about snippet versions_tags : 0.7.0, 0.7.1, 0.7.2, 1.0, 1.1 # compatible versions ( always use the dots between the numerals e.g 0.6.0 or 0.7.1 ) reference_url : http://forum.foxycart.com/comments.php?DiscussionID=5246&page=1 # Item_7 # External link tags_tags : validation # tags, separated by commas. date_dt : 2011-11-18 # the date in YYYY-MM-DD format ---- ====== Validating Add-To-Cart Form Inputs ====== Assuming a basic HTML add-to-cart form like this, where you want to ensure that the ''select'' element isn't empty before you all the product to be added to the cart:
Size:
You'd use some javascript like this (inside a ''