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

Description

Renders the empty input widget (with its label and help text) for one field of a slice, ready to drop into a custom new-item submission form - the building block of hand-built filler/registration forms that post to filler.php. Give it the slice id and the field id; the widget is the same one the item editor would show for that field, and its form-control name is aa[nINDEX_SLICE][FIELD] so a filler POST creates a new item. Pass required=1 to mark the field required. You can override the widget with a 3-letter widget_type code (for example sel) and pass widget_properties as a JSON object to tune it (name, input_help, const_arr, row_count, input_type, ...). preset_value is accepted but the original code marks it not yet implemented, so do not rely on it. item_index (default 1) sets the aa[nN_...] group number so several inputs on one page belong to the same new item, or to different ones. If the slice or field does not exist the command returns an empty string (unless the slice has autofields, when an unknown field id is cloned from the text field). The companion inputonly does the same without the label and help.

Parameters

slice_id required default (empty string)

The 32-character id of the slice whose field you want a widget for. Required - an empty or unknown slice id makes the command return an empty string.

field_id required default (empty string)

The 16-character field id within that slice (for example headline........ or category........). Required - an unknown field id returns an empty string, unless the slice has autofields set, in which case it is cloned from the text field.

required optional default (empty - optional)

Set to 1 to render the widget as required (adds the required attribute so the browser blocks an empty submit). Empty or 0 leaves it optional.

widget_type optional default (the field's configured widget)

A 3-letter widget code that overrides the widget configured on the field (for example sel for a select, fld for a plain field, dte for a date picker, chb for a checkbox). Leave empty to use the field's own configured widget.

widget_properties optional default (none)

A JSON object that tunes the widget - keys such as name (override the label), input_help (override the help), const_arr (option list for sel), row_count, input_type. Pass either a JSON object or a string holding a JSON object.

preset_value optional default (none)

A starting value for the new field (single value or JSON). The original code marks this not yet implemented, so do not rely on it.

item_index optional default 1

The number N in the generated control name aa[nN_slice][field]. Default 1. Use the same index across several inputs to make them one new item, or different indexes to build several new items on one page.

Examples

virtual{input:9e1d2b9f88e3d6c3bf0eb967378610d6:headline........}
Expected(an aa-widget-fld block: a Headline label, a text input named aa[n1_9e1d2b9f...][headline________][0], and the field help)
Actual
Headline of the news
Renders the Headline widget for slice 9e1d2b9f... ready to drop into a custom form. The control name is aa[n1_SLICE][headline________][0], so a filler.php POST of this field creates a new item. Output is HTML, so this example is illustrative, not asserted.
virtual{input:9e1d2b9f88e3d6c3bf0eb967378610d6:headline........:1}
Expected(the same Headline widget, now with required on the input and data-aa-required on the wrapper)
Actual
Headline of the news
Passing required=1 adds the required attribute and a data-aa-required marker so the browser blocks an empty submit. Illustrative (HTML output).
virtual{input:9e1d2b9f88e3d6c3bf0eb967378610d6:integer.........::sel:{"const_arr":{"0":"No","1":"Yes"}}}
Expected(a select widget with options No and Yes instead of the default number input)
Actual
The 4th parameter is a 3-letter widget code that overrides the field's own widget. Here the integer field is shown as a sel (select) and widget_properties supplies the option list via const_arr. Illustrative (HTML output).
virtual{input:9e1d2b9f88e3d6c3bf0eb967378610d6:headline........:::{"name":"Your name","input_help":"Type your full name"}}
Expected(a text widget whose label reads Your name and whose help reads Type your full name)
Actual
Type your full name
widget_properties is a JSON object. name overrides the label and input_help overrides the help text - useful when the form-facing wording should differ from the slice field name. Illustrative (HTML output).
virtual{input:9e1d2b9f88e3d6c3bf0eb967378610d6:headline........:::::2}
Expected(the Headline widget whose control name starts aa[n2_9e1d2b9f...] instead of aa[n1_...])
Actual
Headline of the news
item_index sets the group number N in aa[nN_slice][field]. Index 2 here puts the control in the n2_ group, so it belongs to a different new item than the default n1_ inputs. Illustrative (HTML output).
test[{input:nonexistentslicexxxxxxxxxxxx:headline........}]
Expected[]
Actual[]
If the slice id (or field id) does not exist, the command returns an empty string - so a typo in a form template yields nothing rather than an error. This is the one deterministic, asserted case; every real widget render is HTML and therefore illustrative.