Skip to content

Conversation

saifsultanc
Copy link
Contributor

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2301130622/52247/

Summary

Add support for Tom Select (GP Advanced Select) to work with the Limit Multi-Select snippet.

After the update, standard behaviour (without GPAS) still works fine:
https://www.loom.com/share/a8bbd3644f074653a756523d99541c5a

After the update, the behaviour with GPAS is fixed:
https://www.loom.com/share/8d6463d62cfe47d8884783e1471d3a77

Comment on lines 63 to +71
.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' );
}
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants