Saturday, August 1, 2015

Meteor Form Validation

In my last post I showed how to save form data in meteor. In this post I will show how to validate form data.
For the form validation we will use JQuery validation plugin from atmospherejs. First we will install that.
We need to attach our validation logic when createStudent template is inserted to the DOM. For that we can use Template_onrendered function which is provided by meteor.
Then add required attribute to form controls.
Now check the form by changing input values. It will trigger validation functions.
You can add style.css into style folder to make the form more beautiful.
You can customize the error messages like below.
And also you can add your custom validations like below.
Download source code from github.

No comments:

Post a Comment