Skip to content

Instantly share code, notes, and snippets.

@bogutski
Created November 20, 2016 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogutski/a9165403c249fe7e45600eb694019144 to your computer and use it in GitHub Desktop.
Save bogutski/a9165403c249fe7e45600eb694019144 to your computer and use it in GitHub Desktop.
Meteor.js Autoform
// Example object
Cars = new Mongo.Collection('cars');
Cars.attachSchema(new SimpleSchema({
make: {
type: String,
label: "Make",
max: 20,
},
model: {
type: String,
label: "Model",
max: 20,
},
plate: {
type: String,
label: "Plate",
max: 20,
},
color: {
type: Object,
},
"color.colorId": {
type: String,
autoform: {
afFormGroup: {
'formgroup-class': 'col-sm-6'
},
options: function () {
return Colors.find().map(function (p) {
return {label: p.colorName, value: p._id};
});
},
// class: 'hidden',
// label: false
}
},
"color.colorName": {
// console.log(123);
type: String,
defaultValue: '.',
autoform: {
// type: "hidden",
// label: false
},
},
"color.colorCode": {
type: String,
defaultValue: '.',
autoform: {
// type: "hidden",
// label: false
},
},
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment