Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
I have a very strange scenario, where I need to validate product options fields, that are used by Couch Cart.

The product options fields are generated by Couch, of course, I am just using jQuery to add the HTML5 required attribute:

Code: Select all
$( ".product-options input" ).attr( "required", "true" );


I am ok with just a simple HTML5 validation, but when populating all the product options fields, the submit button doesn't do anything.

Has anyone maybe been in this situation? Can the product options fields be validated ?
I managed to get it working. For some reason HTML5 validation didn't work, when ckicking on Add to cart button, nothing would happen. (I believe this is due to fact that Couch form also uses the same syntax: required="1").

Then I tried with validate.js, it is a very lightweight vanilla JS form validation plugin, and voila, I can validate product options fields, and the Add to cart functionality works like expected :)
2 posts Page 1 of 1