Using Gravity Forms ‘gform_addnote_button’ PHP action

The gform_addnote_button Gravity Forms PHP filter allows you to modify the HTML of the “Add Note” button for Entry Notes on the Entry Detail page.

Usage

add_filter('gform_addnote_button', 'your_function_name', 10, 1);

Parameters

  • $note_button (string): The HTML for the “Add Note” button.

More information

See Gravity Forms Docs: gform_addnote_button

Examples

Change button text and style

Change the text and styling of the “Add Note” button.

add_filter('gform_addnote_button', 'change_button_text_and_style', 10, 1);
function change_button_text_and_style($note_button) {
    $note_button = '<input type="submit" name="add_note" value="' . esc_attr__('Add A Note To Your Entry', 'gravityforms') . '" class="button" style="width:auto;padding-bottom:2px;background-color:blue;color:white" onclick="jQuery(\'#action\').val(\'add_note\');" />';
    return $note_button;
}

Remove the “Add Note” button

Hide the “Add Note” button by returning an empty string.

add_filter('gform_addnote_button', 'remove_add_note_button', 10, 1);
function remove_add_note_button($note_button) {
    return '';
}

Add a custom CSS class

Add a custom CSS class to the “Add Note” button.

add_filter('gform_addnote_button', 'add_custom_css_class', 10, 1);
function add_custom_css_class($note_button) {
    return str_replace('class="button"', 'class="button custom-class"', $note_button);
}

Add a data attribute

Add a custom data attribute to the “Add Note” button.

add_filter('gform_addnote_button', 'add_data_attribute', 10, 1);
function add_data_attribute($note_button) {
    return str_replace('class="button"', 'class="button" data-custom-attribute="example"', $note_button);
}

Change button type

Change the “Add Note” button to a different input type, such as a button element.

add_filter('gform_addnote_button', 'change_button_type', 10, 1);
function change_button_type($note_button) {
    return '<button type="submit" name="add_note" class="button" onclick="jQuery(\'#action\').val(\'add_note\');">' . esc_attr__('Add Note', 'gravityforms') . '</button>';
}

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