2017-10-10 25 views
0

나는 유성에 새로 온 사람과 나는 다중 선택 상자를 구현하고 싶습니다 나는 aldeed/meteor-autoform유성 다중 선택 자동 폼 오류

에서 유성 자동 폼에 문제가있다.

Exercises = new Mongo.Collection('exercises'); 
ExerciseSchema = new SimpleSchema({ 
name: { 
    label: "Name", 
    type: String 
}, 
tags: { 
    label: "Tags", 
    type: Tags 
}}); 

Tags = new SimpleSchema({ 
wow: { 
    type: String, 
    allowedValues: ['red', 'green', 'blue'], 
    autoform: { 
     options: [ 
      {label: "Red", value: "red"}, 
      {label: "Green", value: "green"}, 
      {label: "Blue", value: "blue"} 
     ] 
    } 
}}); 

그리고 내 HTML에서 나는 그것이 Multiple select box select

처럼 제대로 표시하지만 여러 요소를 선택하고 내 자동 폼에서 제출 버튼을 클릭하면, 내가 얻을 브라우저에서

{{#autoForm collection="Exercises" id="insertExerciseForm" type="insert" resetOnSuccess=true}} 
      <div class="card-content"> 
       {{> afQuickField name='tags.wow' type='select-multiple'}} 
      </div> 

를 삽입

내 브라우저 콘솔에서이 오류가 발생했습니다.

Error in insertExerciseForm insert Error: Wow must be of type String 

afQuickField에서 type = 'select-multiple'을 제거하면 하나의 요소 만 선택할 수 있으므로 정상적으로 작동합니다. 하지만 복수 요소를 선택해야합니다

누군가 나를 도울 수 있습니까? 내 Englisch

답변

0

[문자열] 도움이되지 않습니다.

나는 그것을 발견했다.

Tags = new SimpleSchema({ 
wow: { 
type: Array, 
allowedValues: ['red', 'green', 'blue'], 
autoform: { 
    options: [ 
     {label: "Red", value: "red"}, 
     {label: "Green", value: "green"}, 
     {label: "Blue", value: "blue"} 
    ] 
},'wow.$': { 
    type: String 
}, 
}}); 

하지만 이제는 MongoDB에 값을 저장합니다. 어떻게 레이블과 값을 저장할 수 있습니까?