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

gpep-edit-entry.php: Added support for deleting values for conditionally hidden fields on edit. #724

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

spivurno
Copy link
Contributor

@spivurno spivurno commented Oct 30, 2023

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2398744738/56383/

Summary

Video Overview: https://www.loom.com/share/152186005083436d860d43362ea4609c

If you edit an entry with existing values, and during the edit, an existing value's field is hidden via conditional logic, one would expect that this value would be deleted, but it is not.

This PR resolves that issue by using GFAPI::update_entry() with the entry that has been generated based on the current submission. The current submission entry may differ from the entry stored in the database as GF's default form submission process does not delete values for conditionally hidden fields, only saves/updates new field values.

Note: We'll probably want to implement this for Entry Blocks at some point.

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.

LGTM apart from the PHPCS issues 😃

I'll run a composer lint:fix in another commit as it'll likely fix a ton of other files and muck up this PR.

Copy link

Fails
🚫

Commit message '~ PHPCS' does match the correct format. See our Snippet Library Commit Messages Guidelines in Notion.

🚫

Commit message '~ PHPCS' needs to end in a period or exclamation.

Warnings
⚠️ When ready, don't forget to request reviews on this pull request from your fellow wizards.

Generated by 🚫 dangerJS against 6ada66a

@spivurno spivurno merged commit 9c63f33 into master Oct 31, 2023
@spivurno spivurno deleted the dave/gpep-edit-entry/delete-cl-hidden-values branch October 31, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants