Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/471.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
Javascript 羊驼+;Meteor:如何从按钮处理程序中寻址表单?_Javascript_Twitter Bootstrap_Meteor - Fatal编程技术网

Javascript 羊驼+;Meteor:如何从按钮处理程序中寻址表单?

Javascript 羊驼+;Meteor:如何从按钮处理程序中寻址表单?,javascript,twitter-bootstrap,meteor,Javascript,Twitter Bootstrap,Meteor,我很欣赏这里为羊驼设计的流星套装。它似乎与更标准的羊驼装置略有不同。羊驼文档中的一些示例对我来说不适用于此包。例如,此简单示例作为模式定义的一部分,将导致控制台错误: // alpaca options "options": { "buttons": { "submit": { "click": function() { if (this.isValid(true)) { va

我很欣赏这里为羊驼设计的流星套装。它似乎与更标准的羊驼装置略有不同。羊驼文档中的一些示例对我来说不适用于此包。例如,此简单示例作为模式定义的一部分,将导致控制台错误:

// alpaca options
"options": {
    "buttons": {
        "submit": {
            "click": function() {
                if (this.isValid(true)) {
                    var value = this.getValue();
                }
           }
       }
   }
}
这导致

The compiled template: view-formButtonsContainer for view: VIEW_BOOTSTRAP_EDIT_LIST 
    failed to execute: {"message":"renderedForm is not defined"}
The compiled template: view-form for view: VIEW_BOOTSTRAP_EDIT_LIST failed to execute: 
    {"message":"Alpaca caught an error with the default error handler: The compiled template: 
    view-formButtonsContainer for view: VIEW_BOOTSTRAP_EDIT_LIST failed to execute: 
    {\"message\":\"renderedForm is not defined\"}"}
或者此变体也来自羊驼文档错误({\“message\”:\“rendereform未定义\“}”):

我敢肯定,如果我不是JS新手,这将是微不足道的修复,但对我来说,这是一个难解之谜


我很想在自述文件中看到一些使用此meteor软件包的工作代码变体的示例,以便对其进行调整。

首先,meteor有一个名为atmosphere的便捷软件包管理系统,您应该能够通过键入以下内容来安装alpaca引导软件包:
meteor add mrt:alpaca bootstrap
。然后您还可以获得一些很好的统计数据,如#安装次数


其次,不清楚您将代码放在何处。您的模式定义是否在js文件中?您应该在Template.myTemplate.created回调中执行。请查看:和

谢谢@katogeaver。不,我已经了解了那么多。目前对Meteor非常熟悉。我已经成功安装并使用了六个Meteor软件包。代码在一个js文件中,该文件与相应的模板关联,作为架构南部的alpaca选项定义的一部分。我知道它被正确地包含。事实上,如果没有此按钮代码,alpaca表单将正确地呈现。剩下的问题是,如果按下按钮,我将如何引用表单内容?
if (renderedForm.isValid(true)) {
    value = renderedForm.getValue();
    alert(JSON.stringify(value, null, "  "));
}