I have
Template.templateName.onCreated(function() { this.variableName = new ReactiveVar; this.variableName.set(true); });
and in templateName I have autoform . I need to set the autoform variable variableName to false when autoform sent.
I tried
AutoForm.hooks({ myForm: { onSuccess: function(operation, result) { this.variableName.set(false); }, } });
but it does not work since this. does not refer to template templateName , as happens in helpers and events. This would work if I used sessions instead, as they are not limited / limited to specific templates.
What can I do to change the reactive variable in a car object?
I also tried
AutoForm.hooks({ myForm: { onSuccess: function(operation, result) { this.template.variableName.set(false); this.template.parent.variableName.set(false); this.template.parent().variableName.set(false); this.template.parentData.variableName.set(false); this.template.parentData().variableName.set(false); this.template.parentView.variableName.set(false); this.template.parentView().variableName.set(false); }, } });
When using console.log(this.template) it prints an object. If I use console.log(this.template.data) , I get
Object {id: "myForm", collection: "Meteor.users", type: "update", doc: Object, validation: "submitThenKeyup"…}
I use the variable variableName to determine whether to show an editable form or a good presentation of the data to the user. Perhaps there is another better way to do this.
source share