Choose your database:
MS SQL Server
SQL Anywhere

Subscribe to our news:
Craig Cordell: "The simplicity of your code generator is fantastic. We've evaluated dozens of others over the past few years but have yet to find one that is as easy to use as yours".
Rickey Steinke: "Folks, I wanted to drop a line and give you a fanatic thank you. I have a project due for my computer application course and without PHP Generator I never would have gotten it done with the professional results your product produced. My sincerest gratitude to each and every team member who brought this program to light".


Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next


This event allows you to customize the layout for View, Edit, and Insert forms. Live Demo. Video Tutorial.



function OnGetCustomFormLayout($mode, FixedKeysArray $columns,

                               FormLayout $layout)      




The form mode. Possible values are "edit", "inline_edit", "insert", "inline_insert", and "view".


The associative array of columns displayed in the form.


An instance of the FormLayout class.



Layout structure

The layout has the following hierarchical structure: layout -> groups -> rows -> columns. This means you can add groups to the layout, rows to groups, and columns to rows.


Layout mode

By default all forms are horizontal i.e. the control label is placed on the left of the editor (for vertical forms the label is placed on the top of the editor). To create a vertical form, use the following call:




Adding a group

To add a new group to the layout, use the addGroup method of the FormLayout class:


function addGroup($name = null, $width = 12);


This function returns an instance of the FormLayoutGroup class that can be later used to add rows to the new group (see below). Width is provided in relative units, possible values are integers from 1 to 12.


Adding rows to a group

To add a new row to a group, use the addRow method of the FormLayoutGroup class (see above):


function addRow();


This function has no parameters and returns an instance of the FormLayoutRow class that can be later used to add controls to the new row (see below).


Adding controls to a row

To add a new control to a row, use the addCol method of the FormLayoutRow class (see above):


function addCol($column, $inputWidth = null, $labelWidth = null);


This function also returns an instance of the FormLayoutRow class to allow method chaining. Here $column is an element of the $columns array and $inputWidth and $labelWidth are relative widths of the editor and its label accordingly ($labelWidth can be used only for horizontal forms).



All the examples below can be seen live in our Feature Demo.


Example 1

This example shows how to create a simple group with 2 rows and 2 controls in each row (all controls have equal width):


$displayGroup = $layout->addGroup('Display');


    ->addCol($columns['display_type'], 6)

    ->addCol($columns['display_size'], 6);


    ->addCol($columns['display_resolution_x'], 6)

    ->addCol($columns['display_resolution_y'], 6);


Example 2

This example shows how to create a group and place 3 editors in the same row:


$storageGroup = $layout->addGroup('Storage', 12);


    ->addCol($columns['storage_min'], 4)

    ->addCol($columns['storage_max'], 4)

    ->addCol($columns['storage_external'], 4);


Example 3

This example shows how it is possible to place 2 groups in a row:


$hardwareGroup = $layout->addGroup('Hardware', 6);

$hardwareGroup->addRow()->addCol($columns['chipset'], 12);

$hardwareGroup->addRow()->addCol($columns['cpu'], 12);

$hardwareGroup->addRow()->addCol($columns['gpu'], 12);


$softwareGroup = $layout->addGroup('Software', 6);

$softwareGroup->addRow()->addCol($columns['os_basic'], 12);

$softwareGroup->addRow()->addCol($columns['os_upgradable'], 12);

$softwareGroup->addRow()->addCol($columns['web_browser'], 12);

Prev Return to chapter overview Next