VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: sleepigrl on August 24, 2012, 22:44:24 PM

Title: Custom Field Validation & AJAX add-to-cart
Post by: sleepigrl on August 24, 2012, 22:44:24 PM
I'm working on modifying a version of the Custom Input Text customfield to require that the field be completed before the item can be added to the cart.

Attaching the built-in validationEngine to my add to cart form works great as long as the "Display modal popup upon 'Add to cart'" option in the VM config is not selected.  As soon as that's selected, the validation no longer works.  The item is being added to the cart prior to the validation.

Any hints about what I can look for here so that validation is tested prior to the item being added to the cart?
Title: Re: Custom Field Validation & AJAX add-to-cart
Post by: earlybird on July 25, 2013, 16:56:33 PM
Hey I've the same problem did you find a solution for it ?
Title: Re: Custom Field Validation & AJAX add-to-cart
Post by: sleepigrl on July 25, 2013, 17:01:30 PM
Not really.  The validation works fine as long as I don't use an ajax cart and, since the validation was more important, that's where I left it.
Title: Re: Custom Field Validation & AJAX add-to-cart
Post by: earlybird on July 26, 2013, 10:15:01 AM
I got it working now by editing the

components/com_virtuemart/assets/js/vmprices.js

by adding the validator in the beginning of the function cartEffect

if(document.formvalidator.isValid($$('form.product')[0])){


so it is only added, if the form is valid

cheers
Tobi