Skip to content

yogiben/meteor-autoform-tags-toggle

Repository files navigation

Autoform Tags Toggle

User can togggle predefined tags.

alt tag

###Setup###

  1. Install meteor add yogiben:autoform-tags-toggle

  2. 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]
		autoform:
			type: 'tags-toggle'
			afFieldInput:
				tags: [
					'music',
					'book',
					# alternatively you can set different label than tag value:
					{ label: 'Movies', value: 'movies' }
				]

Entries.attachSchema(Schemas.Entries)
  1. 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}}

Alternatively if you want to save tags as comma separated string, use this schema:

Schemas.Entries = new SimpleSchema
	title:
		type:String
		max: 60

	tags:
		type: String
		autoform:
			afFieldInput:
				type: 'tags-toggle'
				tags: [
					'music',
					'book',
					# alternatively you can set different label than tag value:
					{ label: 'Movies', value: 'movies' }
				]

About

Tags - Autoform custom input type

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published