From dff51931ef9a6ef4cb8a8d635072f439a7de4b1e Mon Sep 17 00:00:00 2001
From: John Kirk <john@civifirst.com>
Date: Sat, 15 Dec 2018 03:23:57 +0000
Subject: [PATCH] Added a not equals comparison operator.

---
 webform_validation.validators.inc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/webform_validation.validators.inc b/webform_validation.validators.inc
index 969d2d2..cfbc1b6 100644
--- a/webform_validation.validators.inc
+++ b/webform_validation.validators.inc
@@ -151,11 +151,11 @@ function webform_validation_webform_validation_validators() {
       'custom_error' => TRUE,
       'custom_data' => array(
         'label' => t('Comparison operator'),
-        'description' => t('Specify the comparison operator you want to use. Must be one of: >, >=, <, <=. The validator will compare the first component with the second using this operator. If the components are of type email, they will get case-insensitive comparison.'),
+        'description' => t('Specify the comparison operator you want to use. Must be one of: >, >=, <, <=, or !=. The validator will compare the first component with the second using this operator. If the components are of type email, they will get case-insensitive comparison.'),
       ),
       'min_components' => 2,
       'max_components' => 2,
-      'description' => t('Compare two values for greater than (>), less than (<), greater than or equal to (>=), or less than or equal to (<=).'),
+      'description' => t('Compare two values for greater than (>), less than (<), greater than or equal to (>=), less than or equal to (<=), or not equals "(!=)".'),
     ),
     'unique' => array(
       'name' => t('Unique values'),
@@ -684,6 +684,12 @@ function webform_validation_webform_validation_validate($validator_name, $items,
             $error = TRUE;
           }
           break;
+
+        case '!=':
+          if (!($entry[1]['value'] != $entry[2]['value'])) {
+            $error = TRUE;
+          }
+          break;
       }
 
       if ($error) {
