/

Form Layout Options

Three ways to arrange a create/edit form's fields, plus the client-side picker for how that form is presented on screen.

The plain default

With no layout configuration at all, every editable field renders one per line, top to bottom, in the table's natural column order (or fields()'s order, if you called it). This needs no setup and is the right choice for short forms:

$xcrud = Xcrud::get_instance();
$xcrud->table('customers');
$xcrud->route('customers');

echo $xcrud->render();

rows() - fields side by side

rows($row, $fields) places two or more fields on the same numbered row of the form instead of stacking them. Every field sharing a row splits that row's full width evenly:

$xcrud->rows(1, 'firstName,lastName');
$xcrud->rows(2, 'city,state,zip');

$row is a row position, not a declaration-order index - rows render in ascending numeric order no matter which rows() call came first in your PHP. A field belongs to at most one row; calling rows() again for it moves it rather than duplicating it. Rows are independent of, and combine freely with, every other layout below.

ParameterTypeDefaultDescription
$rowintrequiredRow position (1 or greater); rows render in ascending numeric order
$fieldsstringrequiredComma-separated list of editable field names to place on this row

rows() + aside() - a persistent side column

aside($fields) pulls fields out of the main form flow entirely and into a separate column that stays visible beside it, while everything else - plain fields, rows() pairs, whatever's left - occupies the main pane. It's commonly combined with rows() so the main pane stays compact and the aside column holds uploads or secondary fields:

$xcrud->rows(1, 'firstName,lastName');
$xcrud->rows(2, 'city,state,zip');
$xcrud->aside('photo,attach');

Aside fields stack top to bottom in the order the form's own field list already puts them in - there's only one aside column, so there's no row number to give it. Note: on a table that also uses https://xcrudnova.xcrud.net/docs/nested-tables-overview, the aside column stays inside just the parent's own "Details" tab panel, not across every nested tab.

ParameterTypeDefaultDescription
$fieldsstringrequiredComma-separated list of editable field names to pull into the side column

The edit-mode picker (client-side)

Independent of how a form's own fields are arranged, set_edit_mode($mode) controls how the form itself is presented when a row is opened for add/edit:

$xcrud->set_edit_mode('side');
ModeDescription
modalCentered popup dialog over the grid (the default)
sideSlide-in drawer/offcanvas panel from the edge of the screen
current"Normal" - the form replaces the grid inline, in the page itself

Two further modes exist but are JS-only - there's no set_edit_mode() value for them, only the toolbar's "⋯ More Options" menu (see https://xcrudnova.xcrud.net/docs/grid-toolbar-and-more-options-menu) can reach them at runtime:

ModeDescription
split_leftGrid and form shown side by side, form docked left, in a resizable split view
split_rightSame split view, form docked right instead

Unlike modal/side, the split modes never hide or cover the grid - its data table simply becomes narrower, and stays fully clickable while a row is being edited alongside it.