gform_field_deleted

Description

This filter fires after a form field is deleted.

Usage

<script type="text/javascript">
    jQuery(document).on('gform_field_deleted', function(event, form, fieldId){
        if (form['id'] == 44 && fieldId == 1){
            //do something specific to this form and field
            alert("You deleted field " + fieldId);
        }
    });
</script>

Parameters

Examples

This example uses the gform_admin_pre_render filter to load the hook. A message is displayed if the form id is 44 and field id 1 is deleted.

add_action( 'gform_admin_pre_render', 'pre_render_function' );
function pre_render_function( $form ) {
    ?>
    <script type="text/javascript">
        jQuery(document).on("gform_field_deleted", function(event, form, fieldId){
            if (form['id'] == 44 && fieldId == 1){
                //do something specific to this form and field
                alert("You deleted field " + fieldId);
            }
        });
    </script>
    <?php
    return $form;
}

Source Code

This filter is located in “form_editor.js”