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

Conversation

saifsultanc
Copy link
Contributor

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2493953931/60560?folderId=3808239

Summary

The snippet doesn't work when the dropdown field choices are not set when the form renders. If choices are populated later based on another field selection, it doesn't work. We need to ensure to re-render the logic with gppa_updated_batch_fields for updated fields.

A quick summary screencast of testing this update:
https://www.loom.com/share/a668853d694b4575b0132a077eeeb00d

…selections logic did not work with some dynamically populated data.
@saifsultanc saifsultanc added the bug Something isn't working label Jan 30, 2024
@claygriffiths
Copy link
Contributor

@saifsultanc I was waiting on a customer to reply before merging #762 but I went ahead and merged it since it will conflict like crazy with this PR.

With the latest version of the snippet, if you put the GPPA listener inside the window.<?php echo __CLASS__; ?> = function() { and call gwDisableDuplicates accordingly on the freshed fields, I think that'll do.

…selections logic did not work with some dynamically populated data.
…selections logic did not work with some dynamically populated data.
@saifsultanc
Copy link
Contributor Author

@saifsultanc I was waiting on a customer to reply before merging #762 but I went ahead and merged it since it will conflict like crazy with this PR.

With the latest version of the snippet, if you put the GPPA listener inside the window.<?php echo __CLASS__; ?> = function() { and call gwDisableDuplicates accordingly on the freshed fields, I think that'll do.

https://github.com/gravitywiz/snippet-library/pull/766/files#diff-ec797900697c813e11e999bf0c339c4d8ff0abf0e3c0f32d5a412a6f4e3d24bbR66-R68

…selections logic did not work with some dynamically populated data.
Copy link
Contributor

@claygriffiths claygriffiths left a comment

Choose a reason for hiding this comment

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

This looks solid. It looks like you need to rebase this with https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-prevent-duplicate-selections.php as there is currently a merge conflict.

You might have to start a new branch based off of master and bring in your changes manually.

More specifically, it looks like you need to bring in the gform_post_conditional_logic behavior, the gppa_updated_batch_fields addition, and whatever else you see fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

3 participants