Jelix 1.8.13

jForms
in package

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.

Tags
subpackage

forms

Table of Contents

DEFAULT_ID  = 0
ERRDATA_FILE_UPLOAD_ERROR  = 5
ERRDATA_INVALID  = 1
ERRDATA_INVALID_FILE_SIZE  = 3
ERRDATA_INVALID_FILE_TYPE  = 4
ERRDATA_REQUIRED  = 2
ID_PARAM  = '__forms_id__'
clean()  : mixed
destroy all form which are too old and unused.
create()  : jFormsBase
Create a new form with empty data.
destroy()  : mixed
destroy a form in the session.
fill()  : jFormsBase|null
get an existing instance of a form, and fill it with data provided by the request.
get()  : jFormsBase|null
get an existing instance of a form.
getSession()  : jFormsSession
__construct()  : mixed
pure static class, so no constructor.

Constants

ERRDATA_FILE_UPLOAD_ERROR

public mixed ERRDATA_FILE_UPLOAD_ERROR = 5
Tags

ERRDATA_INVALID_FILE_SIZE

public mixed ERRDATA_INVALID_FILE_SIZE = 3
Tags

ERRDATA_INVALID_FILE_TYPE

public mixed ERRDATA_INVALID_FILE_TYPE = 4
Tags

Methods

clean()

destroy all form which are too old and unused.

public static clean([mixed $formSel = '' ][, mixed $life = 86400 ]) : mixed

parameters are deprecated and unused

Parameters
$formSel : mixed = ''
$life : mixed = 86400
Tags
Return values
mixed

create()

Create a new form with empty data.

public static create(string $formSel[, string $formId = null ]) : jFormsBase

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.

Parameters
$formSel : string

the selector of the xml jform file

$formId : string = null

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

Tags
Return values
jFormsBase

the object representing the form

destroy()

destroy a form in the session.

public static destroy(string $formSel[, string $formId = null ]) : mixed

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

Parameters
$formSel : string

the selector of the xml jform file

$formId : string = null

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

Tags
Return values
mixed

fill()

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

public static fill(string $formSel[, string $formId = null ]) : jFormsBase|null

use it in the action called to submit a webform.

Parameters
$formSel : string

the selector of the xml jform file

$formId : string = null

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

Tags
Return values
jFormsBase|null

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

get()

get an existing instance of a form.

public static get(string $formSel[, string $formId = null ]) : jFormsBase|null

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

Parameters
$formSel : string

the selector of the xml jform file

$formId : string = null

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

Tags
Return values
jFormsBase|null

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

__construct()

pure static class, so no constructor.

private __construct() : mixed
Tags
Return values
mixed

Search results