User Guide & Reference Manual

Form Model

Forms are comprised of custom fields, configured at Publish > Forms, and allow the administrator to easily build complex forms without any HTML or programming knowledge. This model gives you the power to create, update, retrieve, and delete forms. Also, record and retrieve form submissions.

Initialization


$this->load->model('forms/form_model');

Method Reference

int new_form (string $title , string $url_path , string $text , string $button_text , string $redirect [, string $email = '' [, array $privileges = array() [, string $template = 'form.thtml']]])

Create a new form.

int update_form (int $form_id , string $title , string $url_path , string $text , string $button_text , string $redirect [, string $email = '' [, array $privileges = array() [, string $template = 'form.thtml']]])

Update an existing form.

boolean delete_form (int $form_id)

Delete a form.

int get_form_id (string $url_path)

Get a form ID from a URL path. Used in the forms controller.

array get_form (int $form_id)

Retrieve a form based on its ID, in the same format as get_forms().

array get_forms ( [array $filters = array()])

Retrieve a form or forms in an array based on optional filters.

Possible Filters:

Each form array has the following data:

int new_response (int $form_id [, int $user_id = FALSE [, array $custom_fields = array()]])

Insert a new response into the database for a particular form. The $custom_fields array is generated by the Form Builder's post_to_array (documentation).

boolean delete_response (int $form_id , int $response_id)

Delete a response.

array get_response (int $form_id , int $response_id)

Retrieve a single response, in the same format as get_responses().

array get_responses ( [array $filters = array()])

Retrieve a response or multiple responses based on optional filters.

The $filters['form_id'] is a required filter.

Possible Filters:

Each response array has the following data: