Notes from the 'ClientSideValidations for Ember' session
Speaker
Brian Cardarella
Summary
The ClientSideValidations gem for Rails has been the best way to extract validations for the client. Recently Brian has been porting the code over to use with Ember apps. This effort includes building out a FormBuilder base and similar syntactic sugar as SimpleForm. He'll walk you through what he's been up to, and what's coming next.
Experience
Been working with client side validations for a couple of years.
Client side validations
- Rails gem
- Supports custom calidations
- Renders client side same as server side
- When in doubt prefer server side
Ember-data-validations
Ember-formbuilder
Client side validations ember
Bootstraps your ember app modles with server side validations
Challenges
Ember-formbuilder
- Support more input types (on Ember?)
- How errors are rendering
- i18n support for labels
Ember-data validations
- Don't block, use promises
- i18n error messaging
- Don't overwrite pre-defined validations
- Framework (Rails) specific
Ember-data
- Add 'validating' state to DS.StateManager prior to 'inFlight'
inFlight.becameInvalid
should not blow awaymodel.errors
object
Ideal validation workflow
- Client validations pass
- Send to server
- Server side validations fail and notifies client
Ideal validation workflow + 1
- Client validations pass
- Send to server
- Server side validations pass
- Record attempts to save, database contraints fail, validation bubbles up and notifies client
Thanks for reading! Follow me on Twitter and/or G+ for more.
See something wrong or got something to add/change? Fork this git repo and send me a pull request
If you particularly enjoy my work, I appreciate donations given with Gitcoin.co