Tags input for autoForm and bootstrap with bootstrap-tagsinput.
###Setup###
-
Install
meteor add yogiben:autoform-tags
-
Define your schema and set the
autoform
property like in the example below
Schemas = {}
@Entries = new Meteor.Collection('entries');
Schemas.Entries = new SimpleSchema
title:
type:String
max: 60
tags:
type: [String] # or String
autoform:
type: 'tags'
afFieldInput:
# bootstrap-tagsinput options
Entries.attachSchema(Schemas.Entries)
- Generate the form with
{{> quickform}}
or{{#autoform}}
e.g.
{{> quickForm collection="Entries" type="insert"}}
or
{{#autoForm collection="Entries" type="insert"}}
{{> afQuickField name="title"}}
{{> afQuickField name="tags"}}
<button type="submit" class="btn btn-primary">Insert</button>
{{/autoForm}}
Tags will be an array of strings if field type is [String]
or comma separated string if field type is String
.
###Options###
console.log @data.atts
See all supported bootstrap-tagsinput options here.