Created
November 20, 2016 18:55
-
-
Save bogutski/a9165403c249fe7e45600eb694019144 to your computer and use it in GitHub Desktop.
Meteor.js Autoform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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