Meteor-Community-Packages / meteor-autoform

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.
MIT License
1.44k stars 328 forks source link

Display custom schema field #1104

Closed Christilut closed 3 years ago

Christilut commented 9 years ago

I can't figure out how to do this. Let's say I have this schema:

MyCollection.attachSchema new SimpleSchema
    title: {
      type: String,
      label: "Title",
      max: 200
      explanation: 'this explains the input'
    }

How can I show the explanation field in my html?
I've already added

SimpleSchema.extendOptions
  explanation: Match.Optional String

so simple-schema is okay with this. But I simply can't figure out how to show the data in the html.

abecks commented 9 years ago

I dont believe the built in field types have support for "explanation".

https://github.com/aldeed/meteor-autoform/blob/8544c659ea5235bbbc9f737e170d405c11e23cac/templates/bootstrap3/components/afFormGroup/afFormGroup.html

Is the container for most of the fields that are rendered. It renders a label, the element, and a help-block for displaying the error message. That help block is not used for an explanation, only validation messages. However, you could extend AutoForm and add your own inputs that make use of this schema property.

See: https://github.com/aldeed/meteor-autoform#defining-custom-input-types