Hi,
I am following this guide https://github.com/aldeed/meteor-autoform#callbackshooks to add a “submitted successfully” message on submit, but it’s not working. Under my client code, I have
import { AutoForm } from 'meteor/aldeed:autoform';
if(Meteor.isClient) {
AutoForm.addHooks(null, hooksObject);
var hooksObject = {
onSubmit: function(insertDoc, updateDoc, currentDoc) {
// You must call this.done()!
//this.done(); // submitted successfully, call onSuccess
//this.done(new Error('foo')); // failed to submit, call onError with the provided error
//this.done(null, "foo"); // submitted successfully, call onSuccess with `result` arg set to "foo"
},
};
};
I don’t really understand what to put inside var hookObjects{ } in order to show a simple “Submitted” message after the form is submitted? Also I’m getting this error in the console irrespective of what I put inside var hooksObect { }:
Uncaught TypeError: Cannot read property ‘before’ of undefined
at Object.addHooksToList (autoform-hooks.js:26)
at Object.autoFormAddHooks [as addHooks] (autoform-api.js:30)
at meteorInstall.imports.ui.getlogins.js (getlogins.js:1707)
at fileEvaluate (install.js:153)
at Module.require (install.js:82)
at Module.Mp.import (runtime.js:70)
at meteorInstall.client.main.js (main.js:1)
at fileEvaluate (install.js:153)
at require (install.js:82)
at main.js:1