-
string
$sel: the form selector
-
jFormsDataContainer
$container: the data container
-
boolean
$reset: says if the data should be reset
declare a child control to the form. The given control should be a child of an other control
add a control to the form
add a control to the form, before the specified control
-
jFormsControl
$control: the control to add
-
string
$ref: The ref of the control the new control should be inserted before
check validity of all data form
boolean
check
()
generate a new token for security against CSRF a builder should call it and create for example an hidden input so jForms could verify it after the submit.
string
createNewToken
()
deactivate (or reactivate) a control
When a control is deactivated, it is not displayes anymore in the output form
void
deactivate
(string $name, [boolean $deactivation = true])
-
string
$name: the name of the control
-
boolean
$deactivation: TRUE to deactivate, or FALSE to reactivate
\jelix\forms\Builder\BuilderBase
getBuilder
(string $buildertype)
-
string
$buildertype: the type name of a form builder. if the name begins by 'legacy.', it load a legacy builder plugin (jelix <=1.4)
-
string
$name: the control name you want to get
string
getData
(string $name)
-
string
$name: the name of the control/data
return list of errors found during the check
array
getErrors
()
returns the old values of the controls which have been modified since
the call of the method initModifiedControlsList()
array
getModifiedControls
()
set data from a DAO, in a control
The control must be a container like checkboxes or listbox with multiple attribute. The form should contain a formId
The Dao should map to an "association table" : its primary key should be composed by the primary key stored in the formId (or the given primarykey) + the field which will contain one of the values of the control. If this order is not the same as defined into the dao, you should provide the list of property names which corresponds to the primary key in this order : properties for the formId, followed by the property which contains the value.
void
initControlFromDao
(string $name, string $daoSelector, [mixed $primaryKey = null], [mixed $primaryKeyNames = null], [string $dbProfile = ''])
-
string
$name: the name of the control
-
string
$daoSelector: the selector of a dao file
-
mixed
$primaryKey: the primary key if the form have no id. (optional)
-
mixed
$primaryKeyNames: list of field corresponding to primary keys (optional)
-
string
$dbProfile: the jDb profile to use with the dao
set form data from a DAO
jDaoRecordBase
initFromDao
(
string $daoSelector, [
string $key =
null], [
string $dbProfile =
''])
-
string
$daoSelector: the selector of a dao file
-
string
$key: the primary key for the dao. if null, takes the form ID as primary key
-
string
$dbProfile: the jDb profile to use with the dao
set form data from request parameters
void
initFromRequest
()
call this method after initilization of the form, in order to track
modified controls
void
initModifiedControlsList
()
check if a control is activated
boolean
isActivated
(string $name)
-
string
$name: the control name
check if a control is readonly
boolean
isReadOnly
( $name)
prepare a dao with values of all controls
mixed
prepareDaoFromControls
(string $daoSelector, [string $key = null], [string $dbProfile = ''])
-
string
$daoSelector: the selector of a dao file
-
string
$key: the primary key for the dao. if null, takes the form ID as primary key
-
string
$dbProfile: the jDb profile to use with the dao
prepare an object with values of all controls
void
prepareObjectFromControls
(object $object, [array $properties = null])
-
object
$object: the object to fill
-
array
$properties: array of 'propertyname'=>array('required'=>true/false, 'defaultValue'=>$value, 'unifiedType'=>$datatype) values of datatype = same as jdb unified types
void
removeControl
( $name)
save all uploaded file in the given directory
void
saveAllFiles
([string $path = ''])
-
string
$path: path of the directory where to store the file. If it is not given, it will be stored under the var/uploads/_modulename~formname_/ directory
save data of a control using a dao.
The control must be a container like checkboxes or listbox with multiple attribute. If the form contain a new record (no formId), you should call saveToDao before in order to get a new id (the primary key of the new record), or you should get a new id by an other way. then you must pass this primary key in the third argument. If the form has already a formId, then it will be used as a primary key, unless you give one in the third argument.
The Dao should map to an "association table" : its primary key should be the primary key stored in the formId + the field which will contain one of the values of the control. If this order is not the same as defined into the dao, you should provide the list of property names which corresponds to the primary key in this order : properties for the formId, followed by the property which contains the value. All existing records which have the formid in their keys are deleted before to insert new values.
void
saveControlToDao
(string $controlName, string $daoSelector, [mixed $primaryKey = null], [mixed $primaryKeyNames = null], [string $dbProfile = ''])
-
string
$controlName: the name of the control
-
string
$daoSelector: the selector of a dao file
-
mixed
$primaryKey: the primary key if the form have no id. (optional)
-
mixed
$primaryKeyNames: list of field corresponding to primary keys (optional)
-
string
$dbProfile: the jDb profile to use with the dao
save an uploaded file in the given directory. the given control must be an upload control of course.
boolean
saveFile
(string $controlName, [string $path = ''], [string $alternateName = ''])
-
string
$controlName: the name of the upload control
-
string
$path: path of the directory where to store the file. If it is not given, it will be stored under the var/uploads/_modulename~formname_/ directory
-
string
$alternateName: a new name for the file. If it is not given, the file while be stored with the original name
save data using a dao.
it call insert or update depending the value of the formId stored in the container
mixed
saveToDao
(string $daoSelector, [string $key = null], [string $dbProfile = ''])
-
string
$daoSelector: the selector of a dao file
-
string
$key: the primary key for the dao. if null, takes the form ID as primary key
-
string
$dbProfile: the jDb profile to use with the dao
void
setData
(string $name, string $value)
-
string
$name: the name of the control/data
-
string
$value: the data value
set an error message on a specific field
void
setErrorOn
(string $field, string $mesg)
-
string
$field: the field name
-
string
$mesg: the error message string
set a control readonly or not
void
setReadOnly
( $name, [boolean $r = true])
-
boolean
$r: true if you want read only
-
$name
void
_diffValues
( &$v1, &$v2)