Jump to content

Guides

ips.ui.stack

Description

The stack widget is a special form control which enables users to enter multiple values for a form field. In IPB 3.x, this was achieved by entering values in a textarea with each value on a new line. This widget is designed to make that functionality more user friendly.

Note: It is expected that the \IPS\Helpers\Form class will be used to build the HTML for stackable controls. Consult the documentation for the PHP class for more information.

 

Options

sortable
(Boolean; optional; default true)

Specifies whether the values in the stack control can be reordered with drag and drop.

 

maxItems
(Number; optional)

If provided, specifies the maximum number of values this stack control will accept.

 

itemTemplate
(Template key; optional; default 'core.forms.stack')

If provided, specifies the template which will be used to dynamically build new rows in the stack control.

 

Events emitted by ips.ui.stack

Events are emitted on the root stack element.

stackInitialized

Triggered when the stack has been built and is initialized.

Event data:

  • count
    Count of the current number of values in the stack control

 

stackRowAdded

Triggered when the user adds a new row to the stack control (either by pressing Enter in an existing row, or pressing the 'Add Another' button).

Event data:

  • count
    Count of the current number of values in the stack control

  Report Guide


×