gform_conditional_logic_values_input

Description

The gform_conditional_logic_values_input JavaScript filter in Gravity Forms allows filtering the input string provided for the conditional logic comparison value.

Usage

gform.addFilter( 'gform_conditional_logic_values_input', function( str, objectType, ruleIndex, selectedFieldId, selectedValue  ) {
    // do stuff
  
    return str;
} );

Parameters

  • str string
    String of the HTML input tag.
  • objectType string
    The type of object: page, field, next_button, confirmation, notification.
  • ruleIndex int
    The index of the rule. The first rule is indexed at 0.
  • selectedFieldId int
    The ID of the field chosen for comparison.
  • selectedValue string
    The value used for comparison.

Example

add_action( 'admin_print_scripts', function () {
	
	if ( method_exists( 'GFForms', 'is_gravity_page' ) && GFForms::is_gravity_page() ) { ?>
        <script type="text/javascript">
            gform.addFilter( 'gform_conditional_logic_values_input', 'set_rule_info' );
            function set_rule_info( str, objectType, ruleIndex, selectedFieldId, selectedValue ){
                str = str.replace('Enter a value', 'Enter the product name');
                return str;
            }
        </script>
    <?php }
	
} );

Placement

Your code snippet should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms version 1.7.6.

Source Code

This filter is located in the function GetRuleValues() in gravityforms/form_admin.js