我需要你的帮助。我已将Autoform更新到版本6.0并且我的表单不起作用,我收到此错误:
Uncaught TypeError: ss.getQuickTypeForKey is not a function
at Object.autoFormGetInputValue [as getInputValue] (autoform-api.js:493)
at HTMLInputElement.<anonymous> (autoform-inputs.js:6)
我的模板.html autoform:这里我有一个简单的插入autoform以插入图像引用和数据。
<template name="insertArtForm">
{{#autoForm collection=artCollection doc=user id="insertArtForm" type="insert"}}
<fieldset>
{{> afQuickField name='createdBy' type='hidden' defaultValue=user._id}}
{{> afQuickField name='createdOn' type='hidden' defaultValue=today}}
<h4>Resolución</h4>
<div class="container">
{{> afQuickField formgroup-class="col-md-1" name='width' type='number'}}
<p class='col-md-1'>x</p>
{{> afQuickField formgroup-class="col-md-1" name='height' type='number'}}
</div>
{{> afQuickField name='name' type='text'}}
{{> afQuickField name='description' type='textarea'}}
{{> afQuickField name='prixQuote' type='text'}}
{{> afQuickField name='artURL' type='text'}}
</fieldset>
<button type="submit" class="btn btn-default" id="js-insert-art-form">Guardar</button>
{{/autoForm}}
</template>
我的.js事件:
Template.insertArtForm.events({
"click #js-insert-art-form": function(e){
console.log("entra en el evento");
$(".js-save-label").css("visibility","visible");
window.setTimeout(function() {
$(".js-save-label").fadeTo(500, 0).slideUp(500, function(){
$(this).remove();
});
}, 3000);
}
});
我的架构:
import { Mongo } from 'meteor/mongo';
import { Index, MinimongoEngine } from 'meteor/easy:search';
import SimpleSchema from 'simpl-schema';
SimpleSchema.extendOptions(['autoform']);
/*Create and export Arts Collection*/
export const Arts = new Mongo.Collection('arts');
/*Arts index for easy:search*/
export const ArtIndex = new Index({
collection: Arts,
fields: ['name'],
engine: new MinimongoEngine(),
});
//Define Art schema
Arts.schema = new SimpleSchema({
createdBy: { //Owner
type: String,
label: "Artista",
regEx: SimpleSchema.RegEx.Id,
optional: true
}, createdOn: {
type: Date,
label: "Fecha",
optional: true
}, height: {
type: String,
label: "Alto",
optional: true
}, width: {
type: String,
label: "Ancho",
optional: true
}, name: {
type: String,
label: "Nombre de la obra",
optional: true
}, description: {
type: String,
label: "Descripción de la obra",
optional: true
}, prixQuote: {
type: String,
label: "PrixQuote",
optional: true
}, artURL: {
type: String,
label: "URL de la obra",
optional: true
}
});
/*Attach the Arts schema for automatic validations*/
Arts.attachSchema(Arts.schema);
我真的很绝望。
答案 0 :(得分:0)
我也遇到过这个问题。请务必在simpl-schema
中安装最新的节点packages.json
。我升级到"simpl-schema": "0.2.3"
,错误就消失了。