-
-
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
Afform - Implement client-side validation of required fields #23604
Conversation
(Standard links)
|
@@ -89,6 +92,10 @@ | |||
} | |||
|
|||
this.submit = function() { | |||
if (!ctrl.ngForm.$valid) { |
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.
@colemanw just wondering if we need to be able to customise the alert here and does this work on front ends? I can't recall if CRM gets loaded correctly on front end
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.
I am not sure if this logic will ever be invoked as required validation happens at field level.
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.
Required validation seems to be working fine on backend and frontend for standard fields.
It needs to be fixed for block like Email block.
@@ -89,6 +92,10 @@ | |||
} | |||
|
|||
this.submit = function() { | |||
if (!ctrl.ngForm.$valid) { |
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.
I am not sure if this logic will ever be invoked as required validation happens at field level.
It's working for fields from the standard entities but not for fields from my custom entity. The fields show as required on the builder page but not on the display page. To test with a custom entity, see https://lab.civicrm.org/dev/core/-/issues/3728 |
I've rebased this @eileenmcnaughton @kurund |
It looks like "required" param is missing in field definition for 'joins'. You can check the generated code. Hence, I the email validation is failing. |
93ad318
to
9004e91
Compare
@kurund I've fixed setting default required value for e.g. Email joins. |
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.
Looks good to me. ready to for merging.
TODO for separate PR
- Select2 fields
- RichText fields
Overview
This is (so far) a client-side only implementation of required field validation for Afforms.
See https://lab.civicrm.org/dev/core/-/issues/3137
Before
Required fields not required.
After