Skip to content

Individual form control validation trigger. #1600

Answered by kevinbuhmann
vzdendyak asked this question in Q&A
Discussion options

You must be logged in to vote

Clarity uses the underlying NgControl for touched and validation state. The ClrForm#markAsTouched is just a way to mark all controls in the form as touched. (Side note: I'm not entirely sure why this method exists because you can do the same thing using the FormGroup#markAllAsTouched method (NgForm#form will give you the FormGroup for a template form). Maybe FormGroup#markAllAsTouched didn't exist when ClrForm#markAsTouched was added. I am not sure.)

Anyway, in Angular, you can mark a single form as touched by calling its markAsTouched method. Then, in order to update the validity state to show the validation messages, you need to call updateValueAndValidity. Again, this is not a Clarity-…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@vzdendyak
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by kevinbuhmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants