Validation Expressions For Promo and Discount Codes

Validation Expressions for Codes

Add the discount code box
Follow these steps when a code is used to apply special pricing:

  1. It is best to first create the registration option (we will come back to it afterwards to adjust for the code).
  2. Create a separate text box for the code.
    • If the registration option is a check box, the code can be placed before or after the RI.
    • If the registration option is a radio button (i.e. Sponsor Registration with Code) then the code needs to be placed after the RI.  
  3. Set logic on this code field to enable or show it when the appropriate registration option is selected.
  4. Add a 'Required Validation' to the field.  This will force the user to enter a code if it shows on the form.  The logic in item 3 determines when it shows.
  5. Add a second Validation to the field, and set it to 'Custom', then click Save.
    • In the Valid Expression box, enter a correctly formatted expression to match the code you would like.  See samples under Code Formatting below.
  6. Apply the code using method (a) or (b) below.

Apply the code to the registration option.

There are 2 ways to apply the code:  (a) using Pricing logic (b) adding a separate registration option for the 'registration with code'
Be aware that by using method (a), a savvy computer user could view all available code even though they do not display on the form, so this is not as secure.
Method (b) is secure and the users cannot view the code, and it is only verified on the ePly server after they submit the form.

Method (a)
  1. Go to the Registration option 
  2. Add a Logic item to the form and set it to Pricing
  3. Add a correctly formatted expression in the Valid Expression box.  See samples under Code Formatting below.
    • for example: Pricing  $100   (when) Code  = xxxx
    • A logic item must be added for each code.
Method (b)
  1. Go to the Registration option 
  2. The registration option type must be either Radio Button or Drop-down list
  3. Add an additional option to be selected when the code is to be used
    • eg: option named: 'Registration with code'
  4. In step 3 under 'Add the discount code box' , set the logic so the code box only shows when the registration type = the 'Registration with code' option (or whatever you name it).

Code formatting:

 

^ - this symbol matches the exact beginning of the field, and prevents people from entering a space at the beginning of the field

$ - this symbol matches the exact end of the field, and prevents people from entering a space at the end of the field

| - this symbol means 'OR', and is often referred to as the 'pipe' symbol.  It is used to set up more than one code that can be successfully matched.

(?i) - optional.  Adding this to the beginning of the matching code indicates that it will be 'Case Insensitive'.  This means that any combination of Upper or Lower case letters can be used.  If this is not used, then it will only match the exact code, using the same case.

 

Samples:

^HSBC157      - matches only 'HSBC157', does not allow spaces at the beginning, but allows spaces at the end.

(?i)^HSBC157$ - matches 'HSBC157' or 'hsbc157' or 'HsbC157', etc., no spaces allowed

(?i)^HSBC157$|^test123$ - matches 'HSBC157' or 'hsbc157' or 'HsbC157' or 'TEst123' or 'test123', etc... no spaces allowed

Comments