Creating meteor autoform w/ array of radio buttons -


i'd build autoform in meteor presents user twelve radio buttons , records entry each of 12 buttons. can form working enough if create 12 different buttons—see below, i'm wondering if possible create array bit more easily.

homework = new mongo.collection("homework"); homework.attachschema(new simpleschema({ userid:{     type: string,     autovalue:function(){return this.userid},  }, username:{     type: string,     autovalue:function(){return meteor.users.findone({_id: this.userid}).emails[0].address}, }, fname:{     type: string,     autovalue:function(){return meteor.users.findone({_id: this.userid}).profile.fname}, }, lname:{     type: string,     autovalue:function(){return meteor.users.findone({_id: this.userid}).profile.lname}, },  page: {     type: number,     label: "page number",     max: 200 }, problem1: {     type: boolean, }, problem2: {     type: boolean, }, problem3: {     type: boolean, }, problem4: {     type: boolean, }, problem5: {     type: boolean, }, problem6: {     type: boolean, }, problem7: {     type: boolean, }, problem8: {     type: boolean, }, problem9: {     type: boolean, }, problem10: {     type: boolean, }, problem11: {     type: boolean, }, problem12: {     type: boolean, },  })); 

yup! can simple define arrays in simpleschema using notation:

...    'problems': {     type: string,     autoform: {       affieldinput: {         options: function () { return {           one: 'one',           two: 'two',           three: 'three',           four: 'four',           five: 'five',           six: 'six',         } }       }     }   }  ... 

and in template

{{ > afquickfield name="problems" noselect=true }} 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -