-
Notifications
You must be signed in to change notification settings - Fork 92
gpnf-attach-child-entry-by-field.php: Fixed an issue with snippet not working on nested modal failed validation.
#1067
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ot working on nested modal failed validation.
## Walkthrough
This change updates the conditional logic within the `hide_parent_entry_id_field` method in the `gp-nested-forms/gpnf-attach-child-entry-by-field.php` file. The modification broadens the condition by adding a check for the absence of the `gform_submission_method` in the POST data when the request action is neither `'gpnf_refresh_markup'` nor `'gpnf_edit_entry'`. This adjustment expands the scenarios under which the method returns the form early without further processing. No changes have been made to any exported or public entities.
## Changes
| File | Change Summary |
|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| gp-nested-forms/gpnf-attach-child-entry-by-field.php | Updated `hide_parent_entry_id_field` method: expanded conditional logic to return the form early if it is not an applicable child form or if the action is neither `'gpnf_refresh_markup'` nor `'gpnf_edit_entry'` and `gform_submission_method` is missing from POST data. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Caller as Requester
participant Method as hide_parent_entry_id_field
participant POST as POST Data
Caller->>Method: Call hide_parent_entry_id_field(form, request)
Note over Method: Check if form is an applicable child form
alt Form is not applicable
Method->>Caller: Return form early
else Form is applicable
Method->>Method: Check if action is 'gpnf_refresh_markup' or 'gpnf_edit_entry'
alt Action is neither 'gpnf_refresh_markup' nor 'gpnf_edit_entry'
Method->>POST: Check for 'gform_submission_method'
alt 'gform_submission_method' is missing
Method->>Caller: Return form early
else 'gform_submission_method' exists
Method->>Caller: Continue processing
end
else Action is 'gpnf_refresh_markup' or 'gpnf_edit_entry'
Method->>Caller: Continue processing
end
endSuggested Reviewers
|
…ot working on nested modal failed validation.
veryspry
approved these changes
May 1, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2896177464/81660
Summary
When a required field in the nested form is not filled out and the validation is displayed, the hidden field (hidden by the snippet) is also displayed.
Loom: https://www.loom.com/share/750a1f3a31be4bce8c1100adb8087922
The logic for hiding the field with the filter
gform_pre_renderdoes not seem to work post validation fail on Nested Form Modal. This is because a condition in an edge case checkrgar( $_REQUEST, 'action' ) !== 'gpnf_refresh_markup' )is true on Nested Form submission. We can add an additionally check forgform_submission_methodon POST to ensure we correctly validate for hidden field scenario.