在Meteor中将表单值传递给服务器

在Meteor中将表单值传递给服务器,meteor,Meteor,我在meteor中有一个简单的表单,可以帮助配置自定义应用程序的执行。 此表单接收两个参数,用户名和密码 <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <

我在meteor中有一个简单的表单,可以帮助配置自定义应用程序的执行。 此表单接收两个参数,用户名和密码

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Execute my custom app</title>
</head>

<body>
  {{> configDetails}}
</body>

<template name="configDetails">
    <div class="container">
        <form class="form-signin" role="form" id="form-signin" >
            <div class="row">
                <div class="span3 offset"><input type="textBox" class="input-block-level" placeholder="User Name" ></div>
                <div class="span3 offset1"><input type="textBox" class="input-block-level" placeholder="Password" ></div>
            </div>                                                          
            <input class="btn btn-lg btn-primary" type="submit" style="display: block; width: 100%;"  id="submit"/>     
        </form>
    </div>
</template>
如果不能在服务器部分直接接收这些值,我如何在客户端部分接收它们并将它们传递到服务器上。我在客户部门也很难收到这些信息:

if (Meteor.isClient) {

  Template.configDetails.events({
    'click input': function () {
      console.log( 'Submitting form!' );
      // template data, if any, is available in 'this'
      if (typeof console !== 'undefined')
        console.log("You pressed the button");
    }
  });

    Template.configDetails.events({
    'submit form': function( event ){   
      console.log( 'Submitting form!' );
      event.preventDefault();
      event.stopPropagation();
      return false; 
    }
  });

上述函数均不执行console.log方法。知道我做错了什么吗。如果您需要更多信息,请告诉我。

在我的项目中,我使用的smth如下:

Template.configDetails.events({
  "click #submit": function(e, t) {

    e.preventDefault();

    Meteor.call('someMethod', attributes, function(error, id) {
      if (error) {
        return console.log("Error..........");
      } else {
        //Do smth
      }
    });
  });

 }
});

好啊因此,我输入了这段代码,它再次没有运行console.log:Template.configDetails.events({“click#submit”:函数(e,t){console.log('Submitting form!');e.preventDefault();});我刚刚用你的代码创建了一个新的应用程序,一切正常(-:看!我在检查启动meteor应用程序的控制台。但是我必须检查浏览器控制台的输出。我真傻。谢谢。
Template.configDetails.events({
  "click #submit": function(e, t) {

    e.preventDefault();

    Meteor.call('someMethod', attributes, function(error, id) {
      if (error) {
        return console.log("Error..........");
      } else {
        //Do smth
      }
    });
  });

 }
});