Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.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
Meteor aldeed:自动形成自定义arrayField模板不工作_Meteor_Meteor Autoform_Simple Schema - Fatal编程技术网

Meteor aldeed:自动形成自定义arrayField模板不工作

Meteor aldeed:自动形成自定义arrayField模板不工作,meteor,meteor-autoform,simple-schema,Meteor,Meteor Autoform,Simple Schema,我已经寻找了有关AutoForm自定义字段模板的教程,但我不确定我的错误在哪里。如果有人有任何建议,我们将不胜感激 我的模式:一个字段是对象数组 guests: { type: Array, minCount: 1, maxCount: 10, label: "Guests in Party" }, "guests.$": { type: Object, label: "Guest Object" }, "guests.$.firstName":

我已经寻找了有关AutoForm自定义字段模板的教程,但我不确定我的错误在哪里。如果有人有任何建议,我们将不胜感激

我的模式:一个字段是对象数组

guests: {
    type: Array,
    minCount: 1,
    maxCount: 10,
    label: "Guests in Party"
},
"guests.$": {
    type: Object,
    label: "Guest Object"
},
"guests.$.firstName": {
    type: String,
    label: "First Name"
},
"guests.$.lastName": {
    type: String,
    label: "Last Name"
}
模板代码:

<template name='afArrayField_guestsObjectField'>
    {{#afEachArrayItem name="guests" minCount="this.atts.minCount" maxCount="this.atts.maxCount"}}
    <div class="form-group">
        <label class="control-label col-sm-2">Guest</label>
        {{> afObjectField name="this.name" label="false" template='customObjectField'}}
        <div class="col-sm-2">
            {{#if afArrayFieldHasLessThanMaximum name="guests"}}
            <button type="button" class="btn btn-primary autoform-add-item" data-autoform-field="{{guests}}" data-autoform-minCount="{{this.atts.minCount}}" data-autoform-maxCount="{{this.atts.maxCount}}"><span class="glyphicon glyphicon-plus"></span></button>
            {{/if}}
            {{#if afArrayFieldHasMoreThanMinimum name="guests"}}
            <button type="button" class="btn btn-primary autoform-remove-item pull-left"><span class="glyphicon glyphicon-minus"></span></button>
        {{/if}}
        </div>
    </div>
    {{/afEachArrayItem}}
</template>

<template name="afObjectField_customObjectField">
    <div class="col-sm-4">
        {{> afFieldInput name="this.firstName" class="form-control" placeholder="First Name"}}

        {{#if afFieldIsInvalid name='this.firstName'}}
            <span class="help-block">{{{afFieldMessage name='this.firstName'}}}</span>
        {{/if}}
    </div>
    <div class="col-sm-4">
        {{> afFieldInput name="this.lastName" class="form-control" placeholder="Last Name"}}

        {{#if afFieldIsInvalid name='this.lastName'}}
            <span class="help-block">{{{afFieldMessage name='this.lastName'}}}</span>
        {{/if}}
    </div>
</template>

{{{#afEachArrayItem name=“guests”minCount=“this.atts.minCount”maxCount=“this.atts.maxCount”}
客人
{{>afObjectField name=“this.name”label=“false”template='customObjectField'}
{{#如果afarrayfieldhaslessthanmimum name=“guests”}
{{/if}
{{{#如果afArrayFieldHasMoreThanMinimum name=“guests”}
{{/if}
{{/afEachArrayItem}
{{>afFieldInput name=“this.firstName”class=“form control”placeholder=“First name”}
{{#如果afFieldIsInvalid name='this.firstName'}
{{{afFieldMessage name='this.firstName'}}
{{/if}
{{>afFieldInput name=“this.lastName”class=“form control”placeholder=“Last name”}
{{#如果afFieldIsInvalid name='this.lastName'}
{{{afFieldMessage name='this.lastName'}}
{{/if}
我遇到的问题是,加号按钮显示在firstName和lastName字段之后,但当我按它时,另一个来宾对象(表单中)不会生成。有什么想法吗