snippet-library icon indicating copy to clipboard operation
snippet-library copied to clipboard

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

Open saifsultanc opened this issue 1 year ago • 2 comments
trafficstars

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

saifsultanc avatar Jan 30 '24 12:01 saifsultanc

@saifsultanc I was waiting on a customer to reply before merging https://github.com/gravitywiz/snippet-library/pull/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.

claygriffiths avatar Jan 30 '24 15:01 claygriffiths

@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

saifsultanc avatar Feb 01 '24 07:02 saifsultanc