Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jquery验证meteor表单提交_Jquery_Validation_Meteor - Fatal编程技术网

使用jquery验证meteor表单提交

使用jquery验证meteor表单提交,jquery,validation,meteor,Jquery,Validation,Meteor,我试图使用jquery和meteor控制电子邮件,当我写错邮件地址时,我可以接收错误消息,但当我写对时,页面会刷新,但不会将邮件保存到数据库中 $('commentForm').validate({ sendForm: false, valid: function() { var ebulten=template.$('#cemail').val(); var o={} o.ebulten=template.$('#cemail

我试图使用jquery和meteor控制电子邮件,当我写错邮件地址时,我可以接收错误消息,但当我写对时,页面会刷新,但不会将邮件保存到数据库中

$('commentForm').validate({
    sendForm: false,
    valid: function() {  
        var ebulten=template.$('#cemail').val();
        var o={}
        o.ebulten=template.$('#cemail').val();
        Ebulten.insert(o);
        alert("it's done!");
        console.log("valid !");
    }
});
footer-layout.html

<template name="footerLayout">
    <div id="footer" class="footer">
        <div class="container">
<form class="cmxform" id="commentForm" action="" method="get">
  <div class="form-group"><span class="f-s-20 text-white">E-Bültene Kayıt     Ol</span></div>
  <div class="form-group"><input name="email" id="cemail"  type="email" class="form-control width-250 m-auto" placeholder="E-  Bültene Kayıt Ol" required></div>
   <div class="form-group"><button type="submit"  id="ebultenkaydet" class="btn btn-theme width-250">E-Bültene Kayıt Ol</button>                     
</div>
</form>
</div>
 </div>
</div>
</template>

E-Bültene Kayıt Ol
E-Bültene Kayıt Ol

是否尝试将event.preventDefault()添加到模板提交事件中?

我尝试过,但结果相同。Template.footerLayout.events({'click#ebultenkaydet':函数(e,Template){……啊,可以尝试将事件从单击更改为提交。这应该会使event.preventDefault()生效。是jQuery.validate()已安装?它在Meteor中不是标准的。您必须安装一些类似于通用模式的东西,以避免表单完全提交,只需添加一个模板事件,直接处理单击提交按钮的操作,在您的情况下,
“\ebultenkaydet click”