【发布时间】:2016-03-03 23:57:10
【问题描述】:
我正在尝试为用户注册添加一个隐藏字段。问题不在于字段本身,而在于它的价值。我想将其解析为默认值。这是我的代码:
Accounts.ui.config({
requestPermissions: {},
extraSignupFields: [{
fieldName: 'name',
fieldLabel: 'Name',
inputType: 'text',
visible: true,
validate: function(value, errorFunction) {
if (!value) {
errorFunction("Please write your first name");
return false;
} else {
return true;
}
}
},{
fieldName: 'status',
fieldLabel: 'Status',
inputType: 'text',
value: 'somevalue',
visible: false,
}]
});
我想将值添加到“状态”字段。
其实我找到了答案。选项是下面的代码 服务器文件夹:
Accounts.onCreateUser(function(options, user) {
if (options.profile) {
user.profile = options.profile;
}
user.profile.status = "sth";
return user;
});
【问题讨论】:
-
你在使用meteor-accounts-ui-bootstrap-3吗?
-
我正在使用 ian:accounts-ui-bootstrap-3。但文档与meteor-accounts-ui-bootstrap-3 相同。
标签: javascript jquery meteor meteor-accounts