Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form Input Validation with Meteor [closed]

Tags:

meteor

Meteor doesn't have a built in validation smart package yet. What validation libraries should I consider? What are other people using?

like image 545
Max Hodges Avatar asked Mar 08 '13 17:03

Max Hodges


3 Answers

We decided to use simpleSchema with Collection2 and autoform for validation. It's a very sophisticated solution. We save a lot of time using this approach rather than trying to roll each form by hand.

Simply by defining a scheme with validation rules (validation rules are provided automatically for data type and isRequired settings) then creating a form with autoForm (a single line of code) and you get all this for free

  • An autogenerated form that uses bootstrap3 classes.
  • Appropriate HTML5 fields for all keys in your collection schema.
  • A submit button that gathers the entered values and inserts them into your collection.
  • Form validation based on the schema attached to your collection. By default the form is validated when the user submits. If anything is invalid, the form is continually re-validated on keyup (throttled) as the user fixes the issues.
  • Default validation error messages that appear under the fields, and can be customized and translated.

meteor-simple-schema A simple, reactive schema validation smart package for Meteor. https://github.com/aldeed/meteor-simple-schema

meteor-collection2 A smart package for Meteor that extends Meteor.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating. Also adds support for virtual fields. https://github.com/aldeed/meteor-collection2

meteor-autoform A smart package for Meteor that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation. https://github.com/aldeed/meteor-autoform

like image 77
Max Hodges Avatar answered Nov 19 '22 12:11

Max Hodges


If you want to use meteorite, you can just search through the atmosphere packages to see what's popular. I'm currently using jqBootstrapValidation. In the past I have used validate.js, but right now I prefer to have something with bootstrap integration. I hear parsley.js is popular with the cool kids, though as of this writing there isn't a smart package for it - but that's easy enough to solve.

like image 31
David Weldon Avatar answered Nov 19 '22 13:11

David Weldon


You already have Tracker as part of Meteor, so I put a little tutorial and JSfiddle together on how to use it to implement a typical form validation scenario.

http://bit.ly/meteor-form-validation-video

http://bit.ly/meteor-form-validation-fiddle

like image 42
Dean Radcliffe Avatar answered Nov 19 '22 12:11

Dean Radcliffe