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 25)


	
			
Class Constant Summary
 ID_PARAM = '__forms_id__'
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 152)

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 50)

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 128)

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 113)

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 83)

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 29)
ERRDATA_INVALID = 1 (line 31)
ERRDATA_REQUIRED = 2 (line 32)
ID_PARAM = '__forms_id__' (line 27)

Documentation generated on Thu, 22 Mar 2012 22:15:33 +0100 by phpDocumentor 1.4.3