webCOMAND

form::update()

Update the form object from an HTML form, and optionally write it to the repository.

This method calls request::update() on the form request, and passes the form object.

Prototype

boolean update(array $options = [])

Parameters

Return

Returns TRUE if the object was successfully updated without any validation or other errors.  FALSE if there was a validation or other error.

The in-memory object will still be updated as much as possible, even if there are validation errors.  This is useful so that if the form is displayed again, the (potentially invalid) values from the in-memory object are available and can be included for modification.  If the 'write' option was specified as 'store', the working copy in the repository will be updated, even if there is a validation error because working copies can have invalid values for the same reason.  If the 'write' option was specified as 'approve' or 'save', the repository will not be updated if there was an error.

Example

$repo = comand::repo();
$contact = $repo->new_object('Contact');
$form = new \io_comand_web\form($contact);
$success = $form->update([
    'method' => 'post',
    'write' => 'approve',
    'log' => &$log
]);

Related

request::update()