Skip to content

Commit c6f05f8

Browse files
committed
gw-conditional-logic-operator-does-not-contain.php: Added snippet for does not contain conditional logic comparison.
1 parent 8ef65ea commit c6f05f8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

gravity-forms/gw-conditional-logic-operator-does-not-contain.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,20 @@ public function output_script() {
8181
return isMatch;
8282
}
8383

84-
var fieldValue = $( '#input_' + formId + '_' + rule.fieldId ).val();
85-
isMatch = fieldValue.indexOf( rule.value ) === -1;
84+
var fieldValue = '';
85+
var $field = $( '#input_' + formId + '_' + rule.fieldId );
86+
87+
// Handle different field types
88+
if ( $field.is(':checkbox') || $field.is(':radio') ) {
89+
fieldValue = $field.filter(':checked').map(function() {
90+
return this.value;
91+
}).get().join(',');
92+
} else if ( $field.is('select[multiple]') ) {
93+
fieldValue = $field.val() ? $field.val().join(',') : '';
94+
} else {
95+
fieldValue = $field.val() || '';
96+
}
97+
isMatch = typeof fieldValue === 'string' && fieldValue.indexOf( rule.value ) === -1;
8698

8799
return isMatch;
88100
} );

0 commit comments

Comments
 (0)