-
Notifications
You must be signed in to change notification settings - Fork 1
Ensure that form data persists when validation fails. #130
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
qasumitbagthariya
left a comment
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.
QA Update ❌
When two Mailchimp forms (including a widget) are present on the same page, the entered data does not persist after submission.
Steps to Reproduce:
- Add two Mailchimp forms (one as a form and one as a widget) on the same page.
- Fill out the form fields in both forms.
- Submit one of the forms.
- Observe that the data in the other form is lost.
Screen.Recording.2025-03-24.at.4.02.23.PM.mov
Testing Environment
- WordPress: 6.7.2
- Theme: Storefront 4.6.1
- Theme: Twenty Twenty-Four 1.3
- PHP: 8.0.30
- Web Server: Nginx 1.20.2
- Browser: Chrome
- OS: macOS 15.2
- Branch: fix/100
QA Update ✅I have verified this PR in the I tested the following on this branch:
Screen.Recording.2025-03-25.at.7.26.54.PM.movTesting Environment
Steps to Test- As mentioned in the PR description.
|
|
Note: We need to make a minor change by adding a class (similar to what we added in the |
Regression / Smoke Test Report ✅Tested with the Testing Environment
Next Step- Ready to Merge 🚀 |
Description of the Change
This PR fixes the form data reset issue by ensuring that form data persists when validation fails.
It only addresses the form reset issue for JavaScript-based submissions, as HTML form submission will be removed in version 1.7.0 (already removed in #126)
Note
This PR resolves the issue by updating the regex to correctly determine whether the response is an error or a success based on the class in the returned markup. Ideally, this should be handled by updating the code to return a proper JSON response, but for now, the fix is applied to the existing code, with potential improvements planned for the future.
Closes #100
How to test the Change
Changelog Entry
Credits
Props @MaxwellGarceau @iamdharmesh
Checklist: