Skip to content

Commit 1f03a9f

Browse files
committed
Clarify available input types in readme
1 parent 956bf64 commit 1f03a9f

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

README.md

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,16 +407,52 @@ See [this demo](http://autoform.meteor.com/qfdetails) for examples of what happe
407407

408408
### afFieldInput
409409

410-
Renders an input control for the field. The type of control depends on what you set the `type` attribute to. All of the HTML5 input types plus a few more are built in. There are add-on packages that provide additional input types (widgets, UI controls).
410+
Renders an input control for the field. The type of control depends on what you set the `type` attribute to. All of the HTML5 input types plus a few more are built in. Here is the full list of included input types:
411+
412+
* boolean-checkbox
413+
* boolean-radios
414+
* boolean-select
415+
* button
416+
* color
417+
* contenteditable
418+
* date
419+
* datetime
420+
* datetime-local
421+
* email
422+
* file
423+
* hidden
424+
* image
425+
* month
426+
* number
427+
* password
428+
* radio
429+
* range
430+
* reset
431+
* search
432+
* select
433+
* select-checkbox
434+
* select-checkbox-inline
435+
* select-multiple
436+
* select-radio
437+
* select-radio-inline
438+
* submit
439+
* tel
440+
* text
441+
* textarea
442+
* time
443+
* url
444+
* week
445+
446+
There are add-on packages that provide additional input types (widgets, UI controls).
411447

412448
If you don't include a `type` attribute, the following logic is used to automatically select an appropriate type:
413449

414-
* If you supply the `options` attribute, a `<select>` control is used. If your schema expects an array for the field, then it is a multiple-select control. If you prefer radios or checkboxes (for example, if it is a short list of options), then add `noselect=true` attribute.
415-
* Otherwise if the schema type is `String` and you include the `rows` attribute, a `<textarea>` is used.
416-
* Otherwise if the schema type is `Number`, `<input type="number">` is used.
417-
* Otherwise if the schema type is `Date`, `<input type="date">` is used.
418-
* Otherwise if the schema type is `Boolean`, the "boolean-checkbox" type is used. You may want to specify an override type of "boolean-radios" or "boolean-select" instead. If you do so, use the `trueLabel` and `falseLabel` attributes to set the labels used in the radio or select control.
419-
* Otherwise `<input type="text">` is used.
450+
* If you supply the `options` attribute, a `select` input is used. If your schema expects an array for the field, then it is a `select-multiple` input. If you prefer radios or checkboxes (for example, if it is a short list of options), then add `noselect=true` attribute or simply set the `type` to `select-checkbox`, `select-checkbox-inline`, `select-radio`, or `select-radio-inline`.
451+
* Otherwise if the schema type is `String` and you include the `rows` attribute, a `textarea` is used.
452+
* Otherwise if the schema type is `Number`, a `number` type is used.
453+
* Otherwise if the schema type is `Date`, a `date` type is used.
454+
* Otherwise if the schema type is `Boolean`, the `boolean-checkbox` type is used. You may want to specify a `type` of `boolean-radios` or `boolean-select` instead. If you do so, use the `trueLabel` and `falseLabel` attributes to set the labels used in the radio or select control.
455+
* Otherwise a `text` type is used.
420456

421457
The following attributes are recognized:
422458

@@ -433,9 +469,9 @@ to capitalize the labels generated from `allowedValues`.
433469
* `noselect`: Use in conjunction with `options` attribute. Set this attribute
434470
to `true` to render radios or checkboxes for the `options` instead of `select`.
435471
* `trueLabel`: Set to the string that should be used as the label for the `true`
436-
option for a boolean field.
472+
option for an input with type `boolean-select` or `boolean-radios`.
437473
* `falseLabel`: Set to the string that should be used as the label for the `false`
438-
option for a boolean field.
474+
option for an input with type `boolean-select` or `boolean-radios`.
439475
* `value`: Set a specific, potentially reactive, value for the input. If you have also provided a `doc` attribute on the `autoForm` or `quickForm`, this value will override the value from the `doc` object.
440476
* `defaultValue`: Set a reactive default value for the input. If you have also provided a `doc` attribute on the `autoForm` or `quickForm`, this value will be used only when the `doc` object has no value for this field. This takes precedence over the `defaultValue` property of the field's schema. (Also, `defaultValue` from the schema is slightly different in that it is never used if you provide a `doc` attribute.)
441477
* Any additional attributes are passed along to the generated DOM element, meaning that you can add `class`, etc. When providing a boolean attribute, set it to `true` (no quotation marks) or a helper that returns `true`.

0 commit comments

Comments
 (0)