row_start(), row_end() form()

Put several fields in one form row under one label (stacked row), e.g. a phone code and number.

form()->row_start($name = '', $extra = [])
form()->row_end($extra = [])

Options

OptionMeaning
descLabel of the row.
name, idName of the row; the errors of its fields mark the row.
class_add_form_groupClasses of the row, after CLASS_STACKED_ROW.

Example

Cancel

Code

return form(['phone_code' => '+380'])
    ->row_start(['desc' => 'Phone', 'name' => 'phone'])
        ->select_box('phone_code', ['+1' => '+1', '+44' => '+44', '+380' => '+380'], ['class_add' => 'input-small'])
        ->text('phone_number', ['placeholder' => 'digits only'])
    ->row_end()
    ->row_start()
        ->save()
        ->link('Cancel', '#cancel', ['class' => 'btn btn-default btn-outline-secondary'])
    ->row_end();

Notes

  • A new row_start() closes an open row.

See also: form/fieldset, demo:form/rows