Class jForms

Description

static class to manage and call a form

A form is identified by a selector, and each instance of a form have a unique id (formId). This id can be the id of a record for example. If it is not given, the id is set to 0.

Located in /forms/jForms.class.php (line 24)


	
			
Class Constant Summary
Method Summary
static void clean ([ $formSel = ''], [integer $life = 86400])
static jFormBase create (string $formSel, [string $formId = null])
static void destroy (string $formSel, [string $formId = null])
static jFormBase fill (string $formSel, [string $formId = null])
static jFormBase get (string $formSel, [string $formId = null])
Methods
static clean (line 154)

destroy all form which are too old and unused

  • access: public
static void clean ([ $formSel = ''], [integer $life = 86400])
  • integer $life: the number of second of a life of a form
  • $formSel
static create (line 52)

Create a new form with empty data

Call it to create a new form, before to display it. Data of the form are stored in the php session in a jFormsDataContainer object. If a form with same id exists, data are erased.

  • return: the object representing the form
  • access: public
static jFormBase create (string $formSel, [string $formId = null])
  • string $formSel: the selector of the xml jform file
  • string $formId: the id of the new instance (an id of a record for example)
static destroy (line 130)

destroy a form in the session

use it after saving data of a form, and if you don't want to re-display the form.

  • access: public
static void destroy (string $formSel, [string $formId = null])
  • string $formSel: the selector of the xml jform file
  • string $formId: the id of the form (if you use multiple instance of a form)
static fill (line 115)

get an existing instance of a form, and fill it with data provided by the request

use it in the action called to submit a webform.

  • return: the object representing the form. Return null if there isn't an existing form
  • access: public
static jFormBase fill (string $formSel, [string $formId = null])
  • string $formSel: the selector of the xml jform file
  • string $formId: the id of the form (if you use multiple instance of a form)
static get (line 85)

get an existing instance of a form

In your controller, call it before to re-display a form with existing data.

  • return: the object representing the form. Return null if there isn't an existing form
  • access: public
static jFormBase get (string $formSel, [string $formId = null])
  • string $formSel: the selector of the xml jform file
  • string $formId: the id of the form (if you use multiple instance of a form)
Class Constants
DEFAULT_ID = 0 (line 28)
ERRDATA_FILE_UPLOAD_ERROR = 5 (line 34)
ERRDATA_INVALID = 1 (line 30)
ERRDATA_INVALID_FILE_SIZE = 3 (line 32)
ERRDATA_INVALID_FILE_TYPE = 4 (line 33)
ERRDATA_REQUIRED = 2 (line 31)
ID_PARAM = '__forms_id__' (line 26)

Documentation generated on Mon, 26 Oct 2015 21:53:36 +0100 by phpDocumentor 1.4.3