CityWebConsultants / Iris

Modular content management and web application framework built with Node.js and MongoDB
http://irisjs.org
Other
9 stars 7 forks source link

Add validation hooks that will prevent submit handlers from firing if… #63

Closed adam-clarey closed 8 years ago

adam-clarey commented 8 years ago

This depends on #62 before it can be merged.

Example validate handers:

iris.modules.forms.registerHook("hook_form_validate", 0, function (thisHook, data) {

  data.errors.push({
    message : "Generic error"
  });
  thisHook.finish(true, data);

});

iris.modules.forms.registerHook("hook_form_validate_login", 0, function (thisHook, data) {

  data.errors.push({
    message : "specific error",
    field: "username"
  });
  thisHook.finish(true, data);

});```