Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.
Domagoj Gojak edited this page Aug 26, 2015 · 12 revisions

Available fields:

TextField

Usage:

<?php

use Formjack\Field\TextField;

// ...

$form->addField(new TextField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • value (string)
    Initial field value.
    Default: ''

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • rules (array)
    Array of validation rules
    Default: array()

EmailField

Usage:

<?php

use Formjack\Field\EmailField;

// ...

$form->addField(new EmailField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • value (string)
    Initial field value.
    Default: ''

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • rules (array)
    Array of validation rules
    Default: array()

NumberField

<?php

use Formjack\Field\NumberField;

// ...

$form->addField(new NumberField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • value (string)
    Initial field value.
    Default: ''

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • rules (array)
    Array of validation rules
    Default: array()

PasswordField

<?php

use Formjack\Field\PasswordField;

// ...

$form->addField(new PasswordField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • value (string)
    Initial field value.
    Default: ''

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • rules (array)
    Array of validation rules
    Default: array()

TextareaField

<?php

use Formjack\Field\TextareaField;

// ...

$form->addField(new TextareaField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • value (string)
    Initial field value.
    Default: ''

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • rules (array)
    Array of validation rules
    Default: array()

SelectField

<?php

use Formjack\Field\SelectField;

// ...

$form->addField(new SelectField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • choices (string|null)
    Array of 'key' => 'value' pairs where key represents the value that will be submited while value represents the choice label.
    Default array()

  • value (array|string|null)
    Preselected value. If multiselect is set to true you can also specify an array of preselected values.
    Default: ''

  • empty_value (string|null)
    Defines the special empty option value (e.g. "-- Choose"). If null, empty options will not show up. Default: null

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • multiselect (bool)
    Enable/disable multiselect.
    Default: false

  • rules (array)
    Array of validation rules
    Default: array()

CountrySelectField

<?php

use Formjack\Field\CountrySelectField;

// ...

$form->addField(new CountrySelectField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • value (array|string|null)
    Preselected value. If multiselect is set to true you can also specify an array of preselected values.
    Default: ''

  • empty_value (string|null)
    Defines the special empty option value (e.g. "-- Choose"). If null, empty options will not show up. Default: null

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • multiselect (bool)
    Enable/disable multiselect.
    Default: false

  • rules (array)
    Array of validation rules
    Default: array()

StateSelectField

<?php

use Formjack\Field\StateSelectField;

// ...

$form->addField(new StateSelectField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • value (array|string|null)
    Preselected value. If multiselect is set to true you can also specify an array of preselected values.
    Default: ''

  • empty_value (string|null)
    Defines the special empty option value (e.g. "-- Choose"). If null, empty options will not show up. Default: null

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • multiselect (bool)
    Enable/disable multiselect.
    Default: false

  • rules (array)
    Array of validation rules
    Default: array()

ProvinceSelectField

<?php

use Formjack\Field\ProvinceSelectField;

// ...

$form->addField(new ProvinceSelectField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • value (array|string|null)
    Preselected value. If multiselect is set to true you can also specify an array of preselected values.
    Default: ''

  • empty_value (string|null)
    Defines the special empty option value (e.g. "-- Choose"). If null, empty options will not show up. Default: null

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • multiselect (bool)
    Enable/disable multiselect.
    Default: false

  • rules (array)
    Array of validation rules
    Default: array()

CheckboxField

<?php

use Formjack\Field\CheckboxField;

// ...

$form->addField(new CheckboxField($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field label.
    Default: ''

  • value (bool)
    Initial value.
    Default: false

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • rules (array)
    Array of validation rules
    Default: array()

CheckboxGroup

<?php

use Formjack\Field\CheckboxGroup;

// ...

$form->addField(new CheckboxGroup($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field group label.
    Default: ''

  • choices (array)
    Array of 'key' => 'value' pairs where key represents the value that will be submited while value represents the choice label.
    Default array()

  • value (array|string|null)
    Preselected value(s).
    Default: array()

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • rules (array)
    Array of validation rules
    Default: array()

RadioGroup

<?php

use Formjack\Field\RadioGroup;

// ...

$form->addField(new RadioGroup($name, $options));

Parameters:

  • $name (string) (required)
    Field name

  • $options (array) (optional)
    Array of field options
    Default: array()

Available options:

  • label (string)
    Field group label.
    Default: ''

  • choices (array)
    Array of 'key' => 'value' pairs where key represents the value that will be submited while value represents the choice label.
    Default array()

  • value (array|string|null)
    Preselected value(s).
    Default: array()

  • attributes (array)
    Array of 'key' => 'value' pairs where key is the field attribute and value is the actual attribute value.
    Default: array()

  • rules (array)
    Array of validation rules
    Default: array()