jForms

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.

package

jelix

subpackage

forms

Methods

pure static class, so no constructor

__construct() 

destroy all form which are too old and unused

clean( $formSel = '', integer $life = 86400) 
static

Arguments

$formSel

$life

integer

the number of second of a life of a form

Create a new form with empty data

create(string $formSel, string $formId = null) : \jFormsBase
static

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.

Arguments

$formSel

string

the selector of the xml jform file

$formId

string

the id of the new instance (an id of a record for example)

Response

\jFormsBase

the object representing the form

destroy a form in the session

destroy(string $formSel, string $formId = null) 
static

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

Arguments

$formSel

string

the selector of the xml jform file

$formId

string

the id of the form (if you use multiple instance of a form)

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

fill(string $formSel, string $formId = null) : \jFormsBase
static

use it in the action called to submit a webform.

Arguments

$formSel

string

the selector of the xml jform file

$formId

string

the id of the form (if you use multiple instance of a form)

Response

\jFormsBase

the object representing the form. Return null if there isn't an existing form

get an existing instance of a form

get(string $formSel, string $formId = null) : \jFormsBase
static

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

Arguments

$formSel

string

the selector of the xml jform file

$formId

string

the id of the form (if you use multiple instance of a form)

Response

\jFormsBase

the object representing the form. Return null if there isn't an existing form

Constants

ID_PARAM

ID_PARAM

DEFAULT_ID

DEFAULT_ID

ERRDATA_INVALID

ERRDATA_INVALID

ERRDATA_REQUIRED

ERRDATA_REQUIRED

ERRDATA_INVALID_FILE_SIZE

ERRDATA_INVALID_FILE_SIZE

ERRDATA_INVALID_FILE_TYPE

ERRDATA_INVALID_FILE_TYPE

ERRDATA_FILE_UPLOAD_ERROR

ERRDATA_FILE_UPLOAD_ERROR