KWF_FORM

Using Kwf_Form you can describe a form including it's fields, labels etc.

It can be used in two ways:

Advantages:

Features:

Usage

class MyForm extends Kwf_Form
{
    protected _initFields()
    {
        $this->add(new Kwf_Form_Field_TextField('name', 'Name'));
        $this->add(new Kwf_Form_Field_NumberField('age', 'Age'))
            ->setAllowNegative(false);
            ->setAllowDecimals(false);
    }
}

Alternative:

$form = new Kwf_Form();
$form->add(new Kwf_Form_Field_TextField('name', 'Name'));
$form->add(new Kwf_Form_Field_NumberField('age', 'Age'))
    ->setAllowNegative(false);
    ->setAllowDecimals(false);

Default Width for Fields in Container

It is possible to set a default width for every field in a container. You only have to call setDefaultFieldWidth on a container.

For example:

$form = new Kwf_Form();
$form->setDefaultFieldWidth(300);
$form->add(new Kwf_Form_Field_TextField('name', 'Name'));

Error Message

Form Error Messages can be shown below the formField or with a bubble. Edit your config.ini to get one of the two styles.

kwc.form.errorStyle = belowField
//OR
kwc.form.errorStyle = iconBubble

Field Properties

The supported properties are based on ExtJS Form config. Look up the relevant Field in the Koala api documentation to get supported properties: http://www.koala-framework.org/docs/ (Form Package)

Additionally for ExtJS forms any property unknown to Koala is used as field config, refer to the ExtJS documentation for all possible properties: http://dev.sencha.com/deploy/ext-2.3.0/docs/?class=Ext.form.NumberField However keep in mind that those won't work for Component forms, and any server side validation / formatting won't happen