{live:item_id:field_id:required:function:widget_type:widget_properties}

Description

Renders one field of an item as an in-place (live) editable widget that saves by itself the moment the editor leaves the field, with no full page reload and no surrounding form. Point it at an item id and a field id; on a published page the field shows its current value as an editable input, and an onchange handler posts the new value back over AJAX. Use the optional required, function (a JavaScript callback run after a successful save), widget_type (a 3-letter widget code such as sel or dte to override the field default) and widget_properties (a JSON object configuring that widget) parameters for finer control. Pass an empty item_id to edit the field of the current item in a loop (to be explicit, write the alias in braces, {_#ITEM_ID_}; a bare _#ITEM_ID_ reaches the command unexpanded and nothing renders). Live editing only renders for a logged-in editor with write permission and the aa-jslib script loaded; for an anonymous visitor, or an unknown item or field, it renders nothing. Related: edit and editfull render the same widget in form style, ajax gives a click-to-open inline editor, and input renders a widget for a brand-new item. The widget gets the value as it is stored: _#ALIASES in the text are not replaced, so the editor sees them as written and the save keeps them. Since November 2026 - before that the template around the command (a view row, an alias) replaced each _#ALIAS in the value, and saving wrote the replaced text back. The same holds for what widget_properties puts into the input itself, such as a placeholder: write an alias there in braces, {_#HEADLINE}, and it is expanded before the command runs. An _#ALIAS in the function is replaced as anywhere else in the template.

Parameters

item_id required

Id of the item whose field you want to edit. Inside a view or loop write the alias in braces, {_#ITEM_ID_} (a bare _#ITEM_ID_ reaches the command unexpanded and nothing renders), or leave it empty to target the current item being rendered.

field_id required

Id of the field to edit, e.g. headline........ or text...........2. The widget shown matches that field's configured input unless you override it with widget_type.

required optional default empty (not required)

Set to 1 to mark the live field as required (adds the required flag to the widget). Default unset means not required.

function optional default empty

JavaScript callback run after a successful save (passed to AA_SendWidgetLive). Use it to react to the change, e.g. location.reload() to refresh the page. Default: none.

widget_type optional default the field's configured widget

Three-letter widget code to override the field default input, e.g. sel for a select, dte for a date picker, chb for a checkbox. Default: the field's own configured widget.

widget_properties optional default empty

JSON object configuring the chosen widget, e.g. {"const_arr":{"0":"no","1":"yes"}} for a select or {"show_time":"1"} for a date widget. Default: none.

Examples

virtual{live:5726c2c6b035d7aab450d1794e9e90d7:headline........}
Expected(an editable input pre-filled with the field value, e.g. Gamma, that auto-saves on blur)
Actual
Save
virtual{live:5726c2c6b035d7aab450d1794e9e90d7:headline........:1}
Expected(the same live input, flagged required so an empty value is rejected on save)
Actual
Save
test[{live:}]
Expected[]
Actual[]
virtual{live:5726c2c6b035d7aab450d1794e9e90d7:headline........:::sel:{"const_arr":{"0":"no","1":"yes"}}}
Expected(a live drop-down with options no and yes instead of the field default input)
Actual
Save
virtual{live:5726c2c6b035d7aab450d1794e9e90d7:headline........::function() { location.reload(); }}
Expected(a live input whose successful save runs the callback, here reloading the page; pass an empty item id to bind it to the current row inside a view loop)
Actual
Save
test[{live:5726c2c6b035d7aab450d1794e9e90d7:nosuchfield000000}]
Expected[]
Actual[]
test[{live:00000000000000000000000000000000:headline........}]
Expected[]
Actual[]