Skip to content

Commit 073c80c

Browse files
committed
gw-conditional-logic-operator-does-not-contain.php: Fixed rule value for does not contain rule.
1 parent d71cc93 commit 073c80c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,11 @@ public function output_admin_inline_script() {
4545
operators.does_not_contain = 'does not contain';
4646
return operators;
4747
} );
48-
gform.addFilter( 'gform_conditional_logic_values_input', function( str, objectType, ruleIndex, selectedFieldId, value ) {
49-
const operator = jQuery( '#field_rule_operator_' + ruleIndex ).val();
50-
if ( operator !== 'does_not_contain' ) {
51-
return str;
52-
}
53-
str = '<input type="text" placeholder="Enter a value" data-js-rule-input="value" class="gfield_rule_select gfield_rule_input active" id="field_rule_value_' + ruleIndex + '" name="field_rule_value_' + ruleIndex + '" value="' + value + '">';
54-
return str;
55-
} );
48+
49+
// Override the default GF function to add our custom operator.
50+
function ruleNeedsTextValue( rule ) {
51+
return ['does_not_contain','contains', 'starts_with', 'ends_with', '<', '>' ].indexOf ( rule.operator ) !== -1;
52+
}
5653
</script>
5754
<?php
5855
}

0 commit comments

Comments
 (0)