Fork me on GitHub

Form Fields array
array (@jarves.field.types.array)

Array of fields.

Result values

If asHash is true and fields contains exactly two items:

{
    valueFromField1: valueFromField2,
    valueFromField1: valueFromField2,
    ...
}

If asHash is true and fields contains more than two items:

{
    valueFromField1: [field2: valueFromField2, field2: valueFromField3],
    valueFromField1: [field2: valueFromField2, field2: valueFromField3],
    ...
}

If asArray is true and you have only one fields item:

[
    valueFromField1,
    valueFromField1,
    ...
]

If asArray is true and you more than one fields item:

[
    [valueFromField1, valueFromField2],
    [valueFromField1, valueFromField2],
    ...
]

All other cases:

[
    {field1: valueFromField1, field2: valueFromField2},
    {field1: valueFromField1, field2: valueFromField2},
    ...
]

Examples:

{
    label: 'Names',
    type: 'array',
    options: {
        columns: [
            {label: 'Name', width: '50%'},
            {label: 'Last Name'}
        ],
        fields: {
            name: {
                type: 'text',
                required: true
            },
            lastName: {
                type: 'text'
            }
        }
    }
}

Notice: In the last example all fields in options.fields are regular jarves.Fields but with the property noWrapper=true set automatically.

Backend » Jarves\Admin\FieldTypes\TypeArray
Frontend » @Jarves/admin/js/jarves/FieldTypes/Array.js

Options

Please note that all fields have common options, that are not displayed on this page. Visit Fields Common Options List for more information.

asHash
(boolean)

asArray
(boolean)

fields
(array)

Array of fields

columns
(array)

Array of {label: 'Column title', width: 'optional width in px'}

startWith
(number)

If defined the field is initialized with x empty items

addText
(text)

If defined overwrites the label of the add button

withoutRemove
(boolean)

Removes the remove button

tableLayout
(boolean)

Whether it should be displayed as table layout

Object changes

This field changes your object in one way or another. It can generate one or more model fields (for Propel mode called columns), new relations to other objects or even add new objects the field needs to work correctly.

Added Fields

Name PHP Type Storage Type
<fieldName> string VARCHAR(255)

Added Relations

None

Added Objects

None

Found a typo? The website is based on Markdown, please feel free to send us a pull request! :) github.com/jarves/jarves.io/tree/master/app/jarves/website/jarves.io