Form fields — PHPRtfLite v1.x documentation

### Navigation

- index
- next |
- previous |
- PHPRtfLite v1.x documentation »

# Form fields

Form fields can be used in cells and sections. The supported form fields in PHPRtfLite are

- Checkboxes
- Dropdown boxes and
- Text fields

## Checkbox

Checkbox example:

    <?php
    $checkbox = $cell->addCheckbox();
    // checkbox is checked
    $checkbox->setChecked();
    $cell->writeText('checkbox label');

## Dropdown

Dropdown box example:

    <?php
    $cell->writeText('dropdown label');
    $dropdown = $cell->addDropdown();
    // set dropdown items
    $dropdown->setItems(array('pear', 'apple', 'pineapple'));
    // add dropdown item
    $dropdown->addItem('orange');

## Text field

Text field example:

    <?php
    $cell->writeText('text field label');
    $textField = $cell->addTextField();
    // set text field text
    $textField->setDefaultValue('Lorem ipsum');

### Navigation

- index
- next |
- previous |
- PHPRtfLite v1.x documentation »