【发布时间】:2016-06-22 05:49:32
【问题描述】:
单击提交按钮后,我有快速表单,此方法被触发
submitPost: function (app) {
check(app, {
title: String,
description: String,
category: String,
price: Number
});
var knownId = Products.insert(app);
Products.update({ _id: knownId }, { $set:{screenShots: scs, previewImage: pi, sourceCode: zip }});
}
当我没有在集合中为“screenShots、previewImage 和 sourceCode”提供默认值时,提交按钮不起作用。
一旦我给了他们一个默认值,如下所示
previewImage: {
type: String,
defaultValue: "jjj",
},
sourceCode: {
type: String,
defaultValue: "jjj",
},
screenShots: {
type: [String],
autoValue: function() {
return [];
}
},
现在表单中的提交按钮正在工作并触发更新方法。它会同时更新“previewImage 和 sourcecCode”,但“screenShots”仍然是空的。
我不确定,但我认为问题与 autoValue 有关,我应该将其设为默认值,但是如何为字符串数组类型的元素赋予默认值?
还是与其他问题有关?
【问题讨论】:
-
我可以知道您使用哪个包进行架构设计吗?
-
@PankajJatav aldeed/meteor-collection2 如果我理解你的问题的话
标签: meteor meteor-autoform meteor-collection2