{inputonly:slice_id:field_id:required:widget_type:widget_properties:preset_value:item_index}

Description

Renders just the editing widget for one field of a slice - the bare form control, with no label and no help text around it. It is the no-chrome twin of input: same parameters, same widget, but input wraps the control in a labelled table row while inputonly emits only the widget itself. Use inputonly when you are building a custom new-item form and want full control over the surrounding markup. The input is named for a new (not-yet-saved) item, so posting the form creates a new item in that slice. If the slice or field cannot be found, inputonly returns an empty string. By default it uses the slice of the item being rendered and the widget the field is configured with; you can override the widget type, pass widget options as JSON, preset a value, mark it required, and index it so several new items fit on one page.

Parameters

slice_id optional default current item's slice

The 32-character id of the slice whose field you want a widget for. Leave empty to use the slice of the item currently being rendered.

field_id required default (none)

The field whose editing widget to render, e.g. headline........ . If the slice or field is not found, inputonly returns an empty string.

required optional default 0 (not required)

Set to 1 to mark the widget required - adds data-aa-required on the wrapper and the required attribute on the input. Any other value leaves it optional.

widget_type optional default the field's configured widget

A 3-letter widget code to override the field's default widget, e.g. fld (text), sel (drop-down), chb (checkbox), dte (date), txt (textarea). Empty uses whatever the field is set to in slice admin.

widget_properties optional default (none)

A JSON object of options for the widget, e.g. {"name":"My label","input_help":"hint","columns":"1"} or {"const_arr":{"0":"No","1":"Yes"}} for a select. Note the order: widget_type is param 4, this is param 5.

preset_value optional default the field's default value

A value to pre-fill the widget with. Accepts a plain string or JSON. With no preset, the field's own default value (if any) is used.

item_index optional default 1

Numbers the form group so several new items can be entered on one page. Index 2 names inputs aa[n2_SLICE][...] instead of aa[n1_SLICE][...].

Examples

virtual{inputonly:9e1d2b9f88e3d6c3bf0eb967378610d6:headline........}
ExpectedA div.aa-widget-fld wrapping a text input named aa[n1_SLICE][headline________][0], with no label or help around it.
Actual
The smallest form. Renders just the editing widget for the headline field of the given slice - no label, no help text. The input is named aa[n1_SLICE][headline________][0], ready to post to a new-item form.
test[{inputonly:9e1d2b9f88e3d6c3bf0eb967378610d6:no_such_field..}]
Expected[]
Actual[]
When the slice or field does not exist, inputonly returns an empty string (it never errors). The brackets show there is nothing between them.
virtual{inputonly:9e1d2b9f88e3d6c3bf0eb967378610d6:headline........:1}
ExpectedSame text widget, now with data-aa-required on the wrapper and the required attribute on the input.
Actual
Param 3 (required) set to 1 adds the data-aa-required marker on the wrapper and the required attribute on the input, so the browser blocks an empty submit.
virtual{inputonly:9e1d2b9f88e3d6c3bf0eb967378610d6:headline........::sel:{"const_arr":{"0":"No","1":"Yes"}}}
ExpectedA select drop-down (div.aa-widget-sel) with options No and Yes instead of the field default text input.
Actual
Param 4 (widget_type) forces a different widget than the field configured - here sel (a drop-down). Param 5 (widget_properties) is a JSON object passed to that widget; const_arr supplies the option list. Note: type is param 4, properties param 5 - in that order.
virtual{inputonly:9e1d2b9f88e3d6c3bf0eb967378610d6:headline........::::Hello world}
ExpectedThe text input opens pre-filled: value="Hello world".
Actual
Param 6 (preset_value) pre-fills the widget. It accepts a plain string or JSON. Here the text input opens with value=Hello world.
virtual{inputonly:9e1d2b9f88e3d6c3bf0eb967378610d6:headline........:::::2}
ExpectedSame widget, but inputs are named aa[n2_SLICE][headline________][0] (index 2) instead of n1.
Actual
Param 7 (item_index) numbers the form group, so several new items can be entered on one page. Index 2 names the input aa[n2_SLICE][...] instead of aa[n1_SLICE][...]; the default index is 1.
virtual{inputonly:9e1d2b9f88e3d6c3bf0eb967378610d6:switch..........}
ExpectedA checkbox (div.aa-widget-chb) named aa[n1_SLICE][switch__________][chb][] plus its hidden default-marker input.
Actual
Whatever widget the field is configured with is what you get. The switch field uses the chb (checkbox) widget, so inputonly emits a checkbox plus its hidden default-marker input.