-
Notifications
You must be signed in to change notification settings - Fork 92
gw-populate-date.php: Fixed an issue where dynamic population did not trigger date population.
#579
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
Conversation
WalkthroughThe changes introduce a new method to extend the Changes
Sequence Diagram(s)sequenceDiagram
participant Modifier as Modifier Field
participant Parent as Parent Field Container
participant GW_Date as GW_Populate_Date Instance
Modifier->>Parent: Change event detected
Parent->>GW_Date: Verify modifier & instance type
GW_Date->>GW_Date: Retrieve inputId and trigger populateDate()
Suggested reviewers
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (2)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
ea2daa5 to
41c8640
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
gravity-forms/gw-populate-date.php (1)
303-314: Optimize the event listener implementation.The current implementation has some minor issues that could be improved:
- The
self instanceof GWPopulateDatecheck is redundant sinceselfis always an instance ofGWPopulateDatewithin this constructor.- There's a trailing whitespace at the end of line 314.
// Listen for any dynamic content loaded on modifier field (if existing) to refresh values on Target. -if ( self.modifier && self instanceof GWPopulateDate ) { +if ( self.modifier ) { var modifier = self.modifier.inputId; if ( modifier ) { var modifierParent = '#field_' + self.formId + '_' + modifier; var modifierTarget = '#input_' + self.formId + '_' + modifier; $( modifierParent ).on( 'change', modifierTarget, function() { self.populateDate( self.sourceFieldId, self.targetFieldId, self.getModifier(), self.format ); } ); } -} +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
gravity-forms/gw-populate-date.php(1 hunks)
🔇 Additional comments (1)
gravity-forms/gw-populate-date.php (1)
303-314: Excellent enhancement for GPPA integration!This addition correctly addresses the issue where changes in the modifier value facilitated by GPPA don't trigger updates in the target date field. By listening for change events on the modifier field's parent element, you're ensuring that dynamically loaded content will properly update the target date field.
… by field value modifier. `gw-populate-date.php`: Updated snippet to tap dynamic content loaded by field value modifier. `gw-populate-date.php`: Updated snippet to tap dynamic content loaded by field value modifier. `gw-populate-date.php`: Updated snippet to tap dynamic content loaded by field value modifier.
bbb3c34 to
4a5f1c8
Compare
gw-populate-date.php: Updated snippet to tap dynamic content loaded by field value modifier.gw-populate-date.php: Fixed an issue where dynamic population did not trigger date population.
|
…ot trigger date population.
|
This is toasted. Going to create a new PR with this branch: https://github.com/gravitywiz/snippet-library/tree/saif/fix/79394-fix-dynamic-population-date |
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2875355741/79394
Summary
If the source date is selected, a change in modifier value (via GPPA) does not trigger the target date field update.
BEFORE:
https://www.loom.com/share/05c946d24eaf4fd4a7132ff98e075ef8
AFTER:
https://www.loom.com/share/4dc0dc1ee8fd4cfb859aa79029a9c81e