Form Validation Done Right | Ward Bell | ng-cof 2022

Channel:
Subscribers:
66,200
Published on ● Video Link: https://www.youtube.com/watch?v=EMUAtQlh9Ko



Duration: 21:06
7,545 views
141


Almost everything you've been told about form validation is a bad practice. Why? Because it tells you to validate the form instead of the model. That's backward. Let me ask you an unsettling question: "is the field required because the form says so or because it's a business model requirement? Would the model be invalid even if we never displayed that field?" Of course we have to express the required rule in the UI. We must tell the user the value is missing and (perhaps) force the user to enter it. But the value is still required whether the field appears on the form or not. And that is just the start of our troubles. We'd like to tell the user if the whole model is valid. We'd want to block certain operations if the model is invalid anywhere. We'd love to display a list of all invalid fields with links the user can click to navigate to the page where they can fix the problem. We'd prefer to find, document, and maintain all of the validation rules in one place and write unit tests for them. We'd like to apply the same rules on both server and client without writing them twice. None of that is possible with validations embedded in forms. This talk is a follow-up to my impassioned argument for Template Driven forms at last year's ngConf (https://www.youtube.com/watch?v=L7rGogdfe2Q). Many folks (incorrectly) try to argue that validation is a weakness of Template Driven forms. I will show that Angular validation, as taught, is a weakness of Reactive forms as well. What we need is a model-driven validation library that integrates with both modalities, one that is powerful and easy to use in the scenarios you wish you could handle today. Of course I'll show you an open-source validation library that we wrote and have used at our biggest Angular client for the last 3 years.

ng-conf is a multi-day Angular conference focused on delivering the highest quality training in the Angular JavaScript framework. 1500+ developers from across the globe converge on Salt Lake City, UT every year to attend talks and workshops by the Angular team and community experts.

Follow us on twitter https://twitter.com/ngconf
Official Website: https://www.ng-conf.org/




Other Videos By ng-conf


2023-05-31Accelerate App Delivery with Low-Code & Figma | Jason Beres & George Abraham from Infragistics
2023-05-11Angular + tRPC: Easy Typesafe API's | Evan Payne | ng-conf Webinar
2023-04-21Angular Community Meetup en Español | April 11th, 2023 | Nelson Gutierrez & Giovanni Rivas
2023-04-13Angular Community Meetup | March 28th, 2023 | Colum Ferry, Emma Twersky, Rob Ocel, & Ady Ngom
2023-04-04Staying Safe and Secure with Angular | Alisa Duncan | ng-conf Webinar
2023-03-31Angular Community Meetup en Español | March 14th, 2023 | Patricio Vargas, Aileen Villaneuva Lecuona
2023-03-29Angular Community Meetup en Español | Feb 14th, 2023 | Mayra Rodríguez & Christian Sánchez
2023-03-14A Guided Approach to Learning RxJS with BrianLove | Roadmap to Learning Angular E7 | ng-conf
2023-03-14Angular Community Meetup | Feb 28th, 2023 | Quantarius Ray, Alisa Duncan, & Colum Ferry
2023-03-13B.L.A.Z.I.N.G. - How to build performant Angular applications | Ady Ngom | ng-conf webinar
2023-03-07Form Validation Done Right | Ward Bell | ng-cof 2022
2023-03-06Deciphering the secrets of blockchain with angular | Stephen Fluin | ng- conf 2022
2023-03-03Angular TDD Like You Never Seen Before | Shai Reznik | ng- conf 2022
2023-03-02Simplifying deep angular forms with di equipped custom components | Rafael Mestre | ng- conf 2022
2023-03-02Career & Community Care: How To Deal With Layoffs | Ngom, Kernaleguen, Patrick | ng-conf webinar
2023-03-01The Angular Report | Stephen Cooper, Preston Lamb, & Jason Warner
2023-03-01Run Code When Leaving Your Angular Application | Preston Lamb | Ng-conf 2022
2023-02-28Standalone Components The Motivation | Pawel Kozlowski | ng-conf 2022
2023-02-28Angular Learning Guide Part 2 with Lukas Ruebbelke| Roadmap to Learning Angular | ng-conf
2023-02-27Why are web applications slow, and what to do about it | Misko Hevery | ng-conf 2022
2023-02-24



Tags:
angular
angularjs
javascript
ngconf
ng-conf
programming
angular conference
ng conference
angular javascript
angular tutorial
Javascript Tutorial
Programming Tutorial
Computer Programming
Google Angular
Google Programming