{inputvar:...}

Description

Renders the input control (the actual edit field - text box, checkbox, select, date selector, file upload, ...) for one slice field, exactly as Slice Admin defines it. It is meaningful only inside a custom item-editing form: when a slice uses a custom field layout (its Input form template, the slice_field setting), AA builds each field control and stores its HTML in the page cache under the key inputvar plus the field id, and this command reads it back. Use it to place individual fields - a headline box, a price input, a checkbox, an image picker - anywhere in your own form layout, for example to put two inputs on one line. The first argument is the field id (the eight-plus-dots id, e.g. headline........). An optional second argument selects a named sub-part of a compound widget instead of the whole control: html_rb and plain_rb (the HTML/plain radio buttons of a text field), day, month, year, time (the pieces of a date field), unselected, selected and presets (parts of a select), file, change, retype, and a few more. Outside an item-editing form the cache key is not set, so the command returns an empty string. Content carried inside a control is protected so any _# aliases it contains are not expanded a second time. The result is never cached.

Parameters

field id required

The id of the slice field whose input control to render (the eight-plus-dots id, for example headline........ or price..........3). The field must exist in the slice whose item is being edited.

part optional default (empty - whole control)

Optional. Selects a named sub-piece of a compound widget instead of the whole control - for example the HTML/plain radio buttons of a text field, the day/month/year/time selectors of a date field, or the selected/unselected lists of a select. Omit it to get the full control.

param optional default (empty)

Optional extra modifier passed through to the sub-piece named by part. Rarely needed; most fields and parts ignore it.

Examples

virtual{inputvar:publish_date....:year}
Expected(only the year dropdown of the date control)
Date controls split into day, month, year and time parts, so you can arrange the pieces of a date field however you like.
virtual{inputvar:full_text.......:html_rb}
Expected(only the HTML-mode radio button of the full_text field)
A second argument selects a sub-piece of a compound widget. html_rb is the HTML-mode radio button of a text field; plain_rb is its plain-text counterpart.
test[{inputvar:headline........}]
Expected[]
Actual[]
inputvar only has a value inside a custom item-editing form. On a normal page (like this one) the cache key is unset, so it returns an empty string.
virtual{inputvar:price..........1}
Expected(the price input control for the first price tier)
Real-world use from a product slice: a custom form lays out many numbered price fields (price..........1, ...2, ...) each rendered with its own inputvar.
virtual{inputvar:headline........}
Expected(the headline input box)
Inside a slice Input form template, this drops the field's edit control - here the headline text box - at exactly this spot in your layout.
virtual{inputvar:first_name......}{inputvar:surname.........}
Expected(the first-name and surname input boxes, side by side)
Place several controls next to each other - the classic reason to write a custom form: two or more inputs on one line of the layout.