-
Notifications
You must be signed in to change notification settings - Fork 92
gw-require-unique-values.php: Added support for whole-field validation for multi-input fields.
#1140
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-require-unique-values.php: Added support for whole-field validation for multi-input fields.
#1140
Conversation
…ion for multi-input fields
WalkthroughThe plugin's version was incremented from 0.2 to 0.3. The validation logic for multi-input fields was updated to allow treating the entire field as a single combined value for uniqueness checks, rather than validating each input separately. The logic in both the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Form
participant Plugin
User->>Form: Submit form with multi-input field
Form->>Plugin: Trigger validate()
Plugin->>Plugin: Check if field ID is in combined field IDs
alt Combined validation
Plugin->>Plugin: Concatenate all subfield values into single string
Plugin->>Plugin: Validate combined value for uniqueness
else Per-input validation
Plugin->>Plugin: Validate each input separately for uniqueness
end
Plugin-->>Form: Return validation result
Form-->>User: Display success or error
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
gravity-forms/gw-require-unique-values.php(3 hunks)
🔇 Additional comments (2)
gravity-forms/gw-require-unique-values.php (2)
14-14: LGTM! Version increment is appropriate.The version bump from 0.2 to 0.3 correctly reflects the addition of new functionality for whole-field validation of multi-input fields.
86-91: Field ID logic verified — no changes required
Thearray_mergeof$this->_args['field_ids']withmaster_field_idand subsequentin_arraychecks match existing patterns in gravity-forms/gw-require-unique-values.php. This whole‐field validation update is consistent with the rest of the class.
…ion for multi-input fields.
gw-require-unique-values.php: Added support for whole-field validation for multi-input fieldsgw-require-unique-values.php: Added support for whole-field validation for multi-input fields.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/3019475786/87093?viewId=8172236
Summary
Original issue/feature request: https://www.loom.com/share/7efd82e759514e21866854c87a802f2a (By Matt A.)
This adds support for allowing multi-input fields to be validated as a single, combined value.
Quick loom showing new feature: https://www.loom.com/share/22a0b59a9b6f46c69f708621f78d507b