Skip to content

Deprecated since 7.2

This page documents the classic module layer (CBController and cbInit()). It still works in every 7.x release, but new code should use resources and pages.

Use instead: Select::make()->relationship(); dependent options need your own field type.

How To Make A Graded Select Boxes In A Form (Parent Select -> Child Select -> Child Select) ​

Provinces Table - provinces ​

Field NameData Type
idint(PK)
created_attimestamp
namevarchar(255)

Cities Table - cities ​

Field NameData Type
idint(PK)
created_attimestamp
namevarchar(255)
provinces_idint(11)

Code ​

php
$this->form[] = ['label'=>'Province','type'=>'select','name'=>'provinces_id','datatable'=>'provinces,name'];
$this->form[] = ['label'=>'City','type'=>'select','name'=>'cities_id','datatable'=>'cities,name','parent_select'=>'provinces_id'];

So you need to add parent_select attribute and fill it with name of previous select name.

What's Next ​

Table Of Contents ​

Released under the MIT License.