Did you try adding ?
'name': { type: String, optional: true, uniforms: TextField }
I'm getting an error while trying to implement vazco/uniforms
with simpleschema. The error message is, Invariant Violation: Unrecognised schema: [object Object]
. I'm not sure what this package is asking for.
Path: Schema
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
import TextField from 'uniforms-bootstrap3/AutoForm'; // Choose your theme package.
export const ProfileCandidate = new Mongo.Collection('profileCandidate');
const ProfileCandidateSchema = new SimpleSchema({
'name.first': {
type: String,
optional: true,
uniforms: TextField
}
});
ProfileCandidate.attachSchema(ProfileCandidateSchema);
Path: Form
import AutoForm from 'uniforms-bootstrap3/AutoForm';
import ProfileCandidateSchema from '../../../../api/profileCandidate/profileCandidate';
export default class CareerHistoryFormPage extends Component {
constructor() {
super(...arguments);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleSubmit(doc) {
console.log("Doc: ", doc);
}
render() {
return (
<div className="paper">
<AutoForm schema={ProfileCandidateSchema} onSubmit={this.handleSubmit} />
</div>
);
}
}