-
Notifications
You must be signed in to change notification settings - Fork 804
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
Forms: Require at least one field #41356
base: trunk
Are you sure you want to change the base?
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. 🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so:
Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 2 files.
|
9cbd589
to
4a04d3b
Compare
This Pr doesn't work for me as expected. I created a form but when I submit it nothing happens. I don't the the expected error. 🤔 |
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.
We update tests in this PR, and I see some failures on the PR checks. I didn't dig into it, but looks like we do introduce some issues. I navigated to projects/packages/forms, and ran composer test-php
.
For this branch, results are:
FAILURES!
Tests: 58, Assertions: 211, Failures: 4, Skipped: 4.
For trunk, results are:
OK, but incomplete, skipped, or risky tests!
Tests: 58, Assertions: 218, Skipped: 4.
There's a console error on this site when I try to submit. That may be the issue.
|
Can you elaborate on the concerns about backward compatibility? I'm not big fan of adding options where there could be smart defaults. :-) In what scenario users would likely disable the toggle? |
I imagine a form with pre-selected checkboxes. For a case like this, we’ll need a more elaborate check. |
A workaround could be to require a field only when input fields only are present. |
Fixes #11886
Background
Currently, contact forms can be submitted with all fields empty, even non-required fields. This leads to empty form submissions that provide no value and potentially waste storage space.
Changes proposed in this Pull Request
Testing instructions
Screenshots