webCOMAND

form::__construct()

Prepare to produce and/or process a form.

Prototype

form __construct(Object $object, array $options = [])

Parameters

  • options - Associative array where the key/value pairs are:
    • action - URL to include in <form>.  Default is empty string.
    • exclude - array of fields to exclude from form and update when iterating.  Default is ['DIndex', 'DOID', 'Folders', 'Type', 'OID', 'UUID']
    • log - where to log events.  Default is repo->SystemLog.
    • method - Method to include in <form> and to use when gathering values from the request.  Options are 'get', 'post' and 'request'.  Default is 'post'.
    • prefix - Prefix to use before Field Identifiers when gathering values from the request.
    • request - A request object to use to retrieve values.  If not provided, a new request object will be created and used automatically.

Example

$repo = comand::repo();
$object = $repo->new_object('Contact');
$form = new \io_comand_web\form($object,[
    'exclude' => array_merge(\io_comand_web\form::DEFAULT_EXCLUDE, [
        'Addresses', 'PhoneNumbers']),
]);
echo($form->form());