Dropdown Remove Button

Adds a Remove button to selection options in Dropdown and MultiSelect fields.

The Remove Button is a built in plugin of Tom Select.

Instructions

  1. Install this snippet with our free Custom JavaScript plugin. https://gravitywiz.com/gravity-forms-code-chest/

Code

Filename: gpadvs-dropdown-remove-button.js

/**
 * Gravity Perks // Advanced Select // Dropdown Remove Button
 * https://gravitywiz.com/documentation/gravity-forms-advanced-select/
 *
 * Adds a Remove button to selection options in Dropdown and MultiSelect fields.
 * 
 * The Remove Button is a built in plugin of Tom Select.
 * @reference https://tom-select.js.org/plugins/remove-button/ 
 *
 * Instructions:
 *
 * 1. Install this snippet with our free Custom JavaScript plugin.
 *    https://gravitywiz.com/gravity-forms-code-chest/
 */
window.gform.addFilter(
    'gpadvs_settings',
    function(settings, gpadvsInstance, selectNamespace) {
        settings.plugins.remove_button = {
            title: window.GPADVS.strings?.remove_this_item
                ? window.GPADVS.strings.remove_this_item
                : 'Remove this item',
        }

        return settings;
    }
);

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.