AbanteCart Community

Shopping Cart Operations => Support => General Support => Topic started by: wshtek on April 24, 2017, 10:48:08 PM

Title: help! need to validate product options during checkout
Post by: wshtek on April 24, 2017, 10:48:08 PM
I have a product built with several selectboxes and options, most set to require a value. instead of defaulting to any particular option value or having a blank value, i have added the option value 'select', to indicate that the user needs to select a value. I have tried several regex expressions to test for the word 'select' (in case the user made no actual selection) and nothing seems to work - using regex seems to always bring up an exception with the option i am testing after 'checkout' is selected. is there any possible way to check for the word 'select' and provide an indication that the user needs to select a value for any particular selectbox when they try to checkout? any help with this would be greatly appreciated !
Title: Re: help! need to validate product options during checkout
Post by: wshtek on April 24, 2017, 11:52:17 PM
with little experience in regular expressions and after much trial and error, i found a solution.

the default list option is 'select...'

the regexp is: /^(?!...$)/

so, if any option returns  '...', the user is prompted for a value. maybe i made this more difficult than need be, but it works :)
Title: Re: help! need to validate product options during checkout
Post by: Basara on April 25, 2017, 03:15:11 AM
Hello.
Try free database of regular expressions http://www.regexlib.com/DisplayPatterns.aspx
Title: Re: help! need to validate product options during checkout
Post by: wshtek on May 09, 2017, 11:21:29 PM
Thanks  :)