AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive va
AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive va
AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation. Versions 6+ of this package require that you separately install the simpl-schema NPM package. Prior versions require and automatically install the simple-schema Meteor package. You can optionally use it with the collection2 package, which you have to add to your app yourself.
AutoForm 7.0 is now available and decouples from the default themes. You will have to install themes manually!
Be sure to check out the change log for full details, first. Note that if you use add-on packages that haven't been updated yet, you will not yet be able to update to version 6.
Add-on Package Authors: Please test your package against AutoForm 7.0, and then release a major version update in which you change your api.use to api.use('aldeed:[email protected]');.
We do NOT recommend using something like api.use('aldeed:[email protected] || 7.0.0'); to try to support multiple major versions of AutoForm because there is currently a known Meteor issue where trying to support too many dependency paths leads to running out of memory when trying to resolve dependencies.
Table of Contents generated with DocToc
schema and collection have quotation marks around it?quickForm or autoForm for both inserts and updates?In a Meteor app directory, enter:
$ meteor add aldeed:autoformAlso install SimpleSchema NPM package separately (AutoForm 6+):
$ npm i --save simpl-schemaAnd then also extend SimpleSchema to allow the autoform option in your schemas, if you plan to use it:
import SimpleSchema from 'simpl-schema';
SimpleSchema.extendOptions(['autoform']);By default there is no theme included, so you will have to install a theme, too. The following themes are available and tested to work with v7:
Please also consider, that twbs:bootstrap is depending on an outdated (and potential insecure!) Bootstrap version.
Better: Use the latest Bootstrap 3.x or 4.x from NPM in favour.
If you update to 7.0.0 you will likely encounter errors from your extension packages like
While selecting package versions:
error: Conflict: Constraint aldeed:[email protected] is not satisfied by aldeed:autoform 7.0.0.
Constraints on package "aldeed:autoform":
* aldeed:autoform@=7.0.0 <- top level
* aldeed:[email protected] <- someone:packagename x.y.zYou can easily circumvent this issue by editing the package entry in .meteor/packages
from aldeed:autoform to aldeed:[email protected]! (note the exclamation mark).
This is because many extensions will not have the 7.0.0 reference in their
package.js file, yet. However, this major version is intended to not break
compatibility with extensions, that worked with 6.x. If you encounter any
runtime issues with extensions, please open an issue.
If you come from a previous version and want to "keep things as they were" then this is the option you should choose.
AutoForm now comes only with the core functionality added to the initial package
code. In order to make the Templates available, too, you only need to
put the following line into your top-level client startup code (for example
imports/startup/client/autoform.js):
import 'meteor/aldeed:autoform/static'That's it. The Templates are now available.
This package supports dynamic-import, which helps to reduce initial bundle
size of the package from ~110 KB to ~60 KB (estimated via bundle-visualizer).
The following example shows how to import the packages dynamically:
import 'meteor/aldeed:autoform/dynamic'
AutoForm.load()
.then(() => {
// ... on init success code, for example set a ReactiveVar to true
))
.catch(e => {
// ... on error code
})You can even combine this with one of the themes (if they support dynamic imports) like in the following example:
…Note, that you can't use the #autoForm or >quickForm Templates before the
import has not completed. You can however use a ReactiveVar in your Temlate
to "wait" with rendering the form:
import { ReactiveVar } from 'meteor/reactive-var'
import { initAutoForm } from 'meteor/aldeed:autoform/dynamic'
const autoFormLoaded = new ReactiveVar()
initAutoForm()
.then(() => autoFormLoaded.set(true))
.catch(e => {
// ... on error code
})
// ... other Template code
Template.myCoolForm.helpers({
loadComplete() {
return autoFormLoaded.get()
}
})Submit a pull request to add your package to this list!
Dates and times:
Selects:
WYSIWYGs:
Markdowns:
Autocompletes:
No open issues yet, or sync has not completed.