Meteor添加模板autoform:动态添加字段不起作用。 TypeError:无法读取属性'键入'未定义的

时间:2016-08-23 17:12:29

标签: javascript mongodb templates meteor meteor-autoform

Schema:

    Schemas.venueManagerProfile = new SimpleSchema({
    managersProfile: {
        type: [Object]
    },
    addManagerChoice:{
        type: String,
        label: 'Want to Add Manager(s) Profile ?',
        optional: true,
        allowedValues: ['Yes', 'No']
    },
    'managersProfile.$.name': {
        type: Object,
    },
    'managersProfile.$.name.firstName': {
        type: String,
        label: 'First name'
    },
    'managersProfile.$.name.lastName': {
        type: String,
        label: 'Last name'
    },
    'managersProfile.$.phone': {
        type: String,
        label: 'Phone number'
    },
    'managersProfile.$.email': {
        type: String,
        label: 'Work email'
    },
    'managersProfile.$.image': {
        type: String,
        optional: true
    },
    'managersProfile.$.officeHours': {
        type: [Object],
        optional: true
    },
    'managersProfile.$.officeHours.$.day': {
        type: String
    },
    'managersProfile.$.officeHours.$.check': {
        type: Boolean,
        label: ' '
    },
    'managersProfile.$.officeHours.$.hours': {
        type: String,
        optional: true
    }
});

HTML:

   <template name="venueListerProfile">
    {{#autoForm id="venue-lister-profile-form" doc=existingData schema=step.schema}}
        <h4 style="margin-bottom: 0"><span>Manager's Profile</span></h4>
        <h5 style="margin: 10px 0 50px 0">Tell us about yourself</h5>

        <div class="row">
            <div class="col-md-2"></div>
            <div class="col-md-8">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="row">

                            <div class="col-md-8">

                            <h4>Hey {{currentUser.profile.firstname}} Do you want add Manager ?? </h4>  

                                <div class="row">
                                {{> afFieldInput  name='addManagerChoice' type='select-radio' options="allowed" rows=2 label-class="col-md-10" input-col-class="col-md-10"}}
                                {{> afQuickField name='addManagerChoice' id="addManagerChoiceID" type='select-radio' options="allowed" rows=2 template="addManager" label-class="col-md-10" input-col-class="col-md-10"}}
                                </div>      

                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <div class="col-md-2"></div>
        </div>



    {{/autoForm}}
</template>


<template name="afRadioGroup_addManager">
    {{#afEachArrayItem name="managersProfile"}}     

                            {{#if addManagerChoice 'Yes'}}
                            {{#if afArrayFieldHasMoreThanMinimum name=../atts.name minCount=../atts.minCount maxCount=../atts.maxCount}}
                                <button type="button" id="managerProfileMinus" class="btn btn-primary autoform-remove-item"><span class="glyphicon glyphicon-minus"> </span></button>
                             {{/if}}
                                  <div class="row">
                                    <div class="col-md-6">{{> afQuickField name='managersProfile.$.name.firstName' label="First Name" placeholder="first name"}}</div>
                                     <div class="col-md-6">{{> afQuickField name='managersProfile.$.name.lastName' label="Last Name" placeholder="last name"}}</div>
                                  </div>
                                  <div class="row">
                                    <div class="col-md-12"> {{> afQuickField name=this.current.phone placeholder="phone number"}}</div>
                                  </div>
                                  <div class="row">
                                    <div class="col-md-12"> {{> afQuickField name=this.current.email placeholder="work email"}} </div>  
                                  </div>

                                {{#if afArrayFieldHasLessThanMaximum name=this.atts.name minCount=this.atts.minCount maxCount=this.atts.maxCount}}
                                  <button type="button" class="btn btn-primary autoform-add-item" data-autoform-field="{{this.atts.name}}" data-autoform-minCount="{{this.atts.minCount}}" data-autoform-maxCount="{{this.atts.maxCount}}">
                                  <span class="glyphicon glyphicon-plus" ></span> </button>
                                {{/if}}
                                {{/if}}
    {{/afEachArrayItem}}                

</template>

加号/减号不显示且不起作用。

screen shot of current screen

我收到以下错误,css未应用于字段。 TypeError:无法读取属性&#39;键入&#39;未定义的 可能的原因是什么以及如何解决它 当用户点击确认它应该保存在数据库上。 提前谢谢。

0 个答案:

没有答案