Autoform Hooks onSuccess

时间:2017-03-13 19:38:36

标签: javascript html meteor hook meteor-autoform

我遇到了使autoform hook工作的问题。目前我正在使用此quickform。

{{>quickForm id="studentForm" collection="Students" type="insert" template="bootstrap3-horizontal" label-class="col-sm-3" input-col-class="col-sm-9"}}

我希望在成功提交表单时显示成功消息。目前我有一个使用此代码的活动:

Template.home.events({
    "submit #student-form": function(event) {
        event.preventDefault();
        swal("Success!", "You have been added to the WaitList", "success")
    }
});

我试图像这样使用autoform hook:

AutoForm.hooks({
    studentForm: {
        onSuccess: function(insert, result) {
            swal("Success!", "You have been added to the wait list", "success")
        }
    }
})

目前这对我不起作用,我很难理解为什么这不起作用。 autoform hooks的文档here

关于我的问题是什么的任何想法?

1 个答案:

答案 0 :(得分:0)

它显然被事件的preventDefault()阻止了。

相关问题