Add fields

See also

/app_extend/add_field

Most fields added need a column in the model associated MYSQL table.

Fields are then added in the CRUD form using the fields key in the configuration file.

Syntax used is using a existing feature, which defines how a column displays.

Moreover, Novius OS team implemented renderers, which allows more freedom. Some renderer allow to select medias, pages, date.

Configuration example:

<?php
return array(
        'name' => array(
                'label' => 'Text displayed next to field',
                'form' => array(
                        'type' => 'text',
                        'value' => 'Default field',
                ),
                'validation' => array(),
);

Standards fields

Bold text is the type property value:

  • <input type=”text“>
  • <input type=”password“>
  • <textarea>
  • <select>
  • <input type=”radio“>
  • <input type=”checkbox“>
  • <input type=”submit“>
  • <input type=”button“>
  • <input type=”file“>

<select> field

<?php
return array(
        'gender' => array(
                'label' => 'Gender',
                'form' => array(
                        'type' => 'select',
                        'options' => array(
                                'm' => 'Male',
                                'f' => 'Female',
                        ),
                ),
                'validation' => array('required'),
        ),
);

<button type=”submit”>

  • type = submit generate <input type="submit">
  • type = button generate <input type="button">

tag property can be used to force HTML tab, for the submit button case.

FuelPHP use automatically value as button text.

<?php
return array(
        'save' => array(
                'form' => array(
                        'type' => 'submit',
                        'tag' => 'button',
                        'value' => 'Save',
                ),
        ),
);

New in version Chiba2.1.

The save key no longer required in CRUD fields configuration.

Renderers (enhanced fields)

renderers list is available in API documentation.

Read the Docs v: elche
Versions
latest
elche
dubrovka
chiba.2
chiba.1
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.