Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gw-prevent-duplicate-selections.php: Fixed an issue with duplicate selections logic did not work with some dynamically populated data. #766

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
11 changes: 9 additions & 2 deletions gravity-forms/gw-prevent-duplicate-selections.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function output_script() {

<script type="text/javascript" defer>

jQuery( function( $ ) {
function process_duplicate_selections($) {
window.gform.addFilter( 'gplc_excluded_input_selectors', function( selectors ) {
selectors.push( '.gw-disable-duplicates-disabled' );
return selectors;
Expand Down Expand Up @@ -203,7 +203,14 @@ function gwDisableDuplicates( $elem, $group, selected ) {
}

}
} );
}

// Loading at the time of form loading.
jQuery( process_duplicate_selections );
// Loading when selections are updated via GP Populate Anything.
jQuery( document ).on( 'gppa_updated_batch_fields', function( event, formId, fieldIds ) {
jQuery( process_duplicate_selections );
})
</script>

<?php
Expand Down
Loading