formfields.txt 919 Bytes
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:

.. code-block:: php

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


Dropdown
=============

Dropdown box example:

.. code-block:: php

    <?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:

.. code-block:: php

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