Author Topic: help! need to validate product options during checkout  (Read 3546 times)

Offline wshtek

  • Newbie
  • *
  • Posts: 12
  • Karma: +1/-0
    • View Profile
help! need to validate product options during checkout
« 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 !
« Last Edit: April 24, 2017, 10:49:40 PM by wshtek »

Offline wshtek

  • Newbie
  • *
  • Posts: 12
  • Karma: +1/-0
    • View Profile
Re: help! need to validate product options during checkout
« Reply #1 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 :)
« Last Edit: April 25, 2017, 12:47:50 AM by wshtek »

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5791
  • Karma: +274/-2
    • View Profile
Re: help! need to validate product options during checkout
« Reply #2 on: April 25, 2017, 03:15:11 AM »
Hello.
Try free database of regular expressions http://www.regexlib.com/DisplayPatterns.aspx

Offline wshtek

  • Newbie
  • *
  • Posts: 12
  • Karma: +1/-0
    • View Profile
Re: help! need to validate product options during checkout
« Reply #3 on: May 09, 2017, 11:21:29 PM »
Thanks  :)

 

Powered by SMFPacks Social Login Mod