aldeed/meteor-autoform — pull request #56 by ajoslin (2013-12-19 17:56:29+00:00)
Title: feature: Add onSuccess hook when any operation succeeds

I added an onSuccess hook. My use-case is that I want to display an alert (eg 'Tenant Saved Successfully') when the form submits - whether it's an insert or an update.

Here's how I'm using it to repeat myself a little less:

```js
var tenantForm;
Meteor.startup(function() {
tenantForm = new AutoForm(Tenants);
tenantForm.hooks({
onSuccess: function(type, result, temlpate) {
if (type == 'insert') {
Router.go('tenantDetail', {_id: result})
}
Alerts.success('Tenant Saved Succesfully');
}
});
});
```
If you think an onError callback would be a good idea too I can add it to the PR.