Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gravity-forms/gw-limit-multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ function limitMultiSelect( $select, max ) {
.find( 'option:not(:checked)' )
.prop( 'disabled', selectedCount >= max )
.trigger( 'chosen:updated' );

// For Tom Select (GP Advanced Select)
// Update "1" to the ID of your Multi Select field.
if ( $( '#input_GFFORMID_1-ts-dropdown' ) ) {
$( '#input_GFFORMID_1-ts-dropdown .option' ).removeAttr( 'data-selectable' );
}
Comment on lines 63 to +71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, if you unselect choices (to get below the max), do the disabled choices get re-enabled?

This snippet reads like even without Tom Select, they'd stay disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}

Expand Down