-
Notifications
You must be signed in to change notification settings - Fork 824
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
CMS 6 - changes to validators #10908
Comments
@GuySartorelli Having a second look at these ACs it seems like they may cause a fair bit of upgrade pain as RequiredFields is a very commonly used class, and it's very likely that projects will forgot to "upgrade" them to be CompositeValidators that includes both a FieldsValidator and a RequiredFields, and now field validation will silently stop working Even when they do remember to add it, it honestly sounds like really annoying boilerplate. People will wonder why they need to add a FieldsValidator since that should really just be there by default I'm keen not to go with the original solution, I can think of a few alternative solutions instead: Option A
Option B
Option C
Option D
My recommendation is Option D as it seems like it should have always been doing this - can you think of any reason to not do this? |
D sounds fine. |
@emteknetnz It's not clear why this is assigned to me - there's no PRs that aren't in draft. |
Sorry forgot to mark PRs as ready for review |
PRs merged. Reassigning to Steve for the next round |
No more rounds, we're done :-) |
Follow up from #10907
Acceptance criteria
RenameFieldsValidator
toFormFieldsValidator
RequiredFields
should be renamedRequiredFieldsValidator
to match the naming convention of other validatorsAnywhere that just addsRequiredFields
to a form should instead addCompositeValidator
with both aFormFieldsValidator
and (if necessary)RequiredFieldsValidator
validatorForm::__construct()
andSilverStripe\AssetAdmin\Forms\RemoteFileFormFactory::getForm()
should explicitly exclude theRequiredFieldsValidator
validatorRequiredFieldsValidator
should not call thevalidate()
method on form fields, as that is the responsibility of theFormFieldsValidator
.RequiredFieldsValidator
can be configured to not consider whitespace only a valueRequiredFieldsValidator
should be configurable to consider whitespace only values to not constitute the presence of a valueRequiredFieldsValidator
instances via a new setter method.false
by default e.g. mimic existing behaviourNote about PRs
I've basically treated this like 3 separate issues and split the PRs
CMS 5 PRs - allow whitespace only
CMS 5 PRs - rename classes
After merging all the above reassign to Steve to merge-up and rebase
Kitchen sink CI CM6 - rename classes
^ Unit test failure is existing
CMS 6 PRs - rename classes
Kitchen sink CI - call form field validate within form
^ Unit test failure is existing
CMS 6 PRs - call form field validate within form
The text was updated successfully, but these errors were encountered: