base class of all form classes generated by the jform compiler
| package |
jelix |
|---|---|
| subpackage |
forms |
__construct(string $sel, \jFormsDataContainer $container, boolean $reset = false)
stringthe form selector
booleansays if the data should be reset
_diffValues( &$v1, &$v2)
addChildControl(\jFormsControl $control)
addControl(\jFormsControl $control)
addControlBefore(\jFormsControl $control, string $ref)
| since | 1.1 |
|---|---|
stringThe ref of the control the new control should be inserted before
check() : boolean
booleantrue if all is ok
createNewToken() : string
| since | 1.1.2 |
|---|---|
stringthe token
deactivate(string $name, boolean $deactivation = true)
| Throws |
|
|---|
stringthe name of the control
booleanTRUE to deactivate, or FALSE to reactivate
getAllData() : array
arrayform data
getBuilder(string $buildertype) : \jelix\forms\Builder\BuilderBase|\jFormsBuilderBase
| Throws |
|
|---|
stringthe type name of a form builder. if the name begins by 'legacy.', it load a legacy builder plugin (jelix <=1.4)
\jelix\forms\Builder\BuilderBase|\jFormsBuilderBase
getControl(string $name) : \jFormsControl
getControls() : array
arrayof jFormsControl objects
getData(string $name) : string
stringthe name of the control/data
stringthe data value
getErrors() : array
| see | \jFormsBase::check |
|---|---|
array
getHiddens() : array
| since | 1.1 |
|---|---|
arrayof jFormsControl objects
getHtmlEditors() : array
| since | 1.1 |
|---|---|
arrayof jFormsControl objects
getModifiedControls() : array
| since | 1.1 |
|---|---|
arraykey=control id, value=old value
getRootControls() : array
arrayof jFormsControl objects
getSelector()
getSubmits() : array
arrayof jFormsControl objects
getUploads() : array
| since | 1.2 |
|---|---|
arrayof jFormsControl objects
getWikiEditors() : array
| since | 1.2 |
|---|---|
arrayof jFormsControl objects
hasUpload() : boolean
boolean
id() : string
stringthe formId
initControlFromDao(string $name, string $daoSelector, mixed $primaryKey = null, mixed $primaryKeyNames = null, string $dbProfile = '')
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.
| see | \jDao |
|---|---|
| Throws |
|
stringthe name of the control
stringthe selector of a dao file
mixedthe primary key if the form have no id. (optional)
mixedlist of field corresponding to primary keys (optional)
stringthe jDb profile to use with the dao
initFromDao(string $daoSelector, string $key = null, string $dbProfile = '') : \jDaoRecordBase
| see | \jDao |
|---|---|
| Throws |
|
stringthe selector of a dao file
stringthe primary key for the dao. if null, takes the form ID as primary key
stringthe jDb profile to use with the dao
\jDaoRecordBase
initFromRequest()
initModifiedControlsList()
| since | 1.1 |
|---|---|
isActivated(string $name) : boolean
stringthe control name
booleantrue if it is activated
isReadOnly( $name) : boolean
booleantrue if it is readonly
prepareDaoFromControls(string $daoSelector, string $key = null, string $dbProfile = '') : mixed
| see | \jDao |
|---|
stringthe selector of a dao file
stringthe primary key for the dao. if null, takes the form ID as primary key
stringthe jDb profile to use with the dao
mixedreturn three vars : $daorec, $dao, $toInsert which have to be extracted
prepareObjectFromControls(object $object, array $properties = null)
objectthe object to fill
arrayarray of 'propertyname'=>array('required'=>true/false, 'defaultValue'=>$value, 'unifiedType'=>$datatype) values of datatype = same as jdb unified types
removeControl( $name)
saveAllFiles(string $path = '')
stringpath of the directory where to store the file. If it is not given, it will be stored under the var/uploads/modulename~formname/ directory
saveControlToDao(string $controlName, string $daoSelector, mixed $primaryKey = null, mixed $primaryKeyNames = null, string $dbProfile = '')
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.
| see | \jDao |
|---|---|
| Throws |
|
stringthe name of the control
stringthe selector of a dao file
mixedthe primary key if the form have no id. (optional)
mixedlist of field corresponding to primary keys (optional)
stringthe jDb profile to use with the dao
saveFile(string $controlName, string $path = '', string $alternateName = '') : boolean
| Throws |
|
|---|
stringthe name of the upload control
stringpath of the directory where to store the file. If it is not given, it will be stored under the var/uploads/modulename~formname/ directory
stringa new name for the file. If it is not given, the file while be stored with the original name
booleantrue if the file has been saved correctly
saveToDao(string $daoSelector, string $key = null, string $dbProfile = '') : mixed
it call insert or update depending the value of the formId stored in the container
| see | \jDao |
|---|
stringthe selector of a dao file
stringthe primary key for the dao. if null, takes the form ID as primary key
stringthe jDb profile to use with the dao
mixedthe primary key of the new record in a case of inserting
setData(string $name, string $value)
| Throws |
|
|---|
stringthe name of the control/data
stringthe data value
setErrorOn(string $field, string $mesg)
stringthe field name
stringthe error message string
setReadOnly( $name, boolean $r = true)
| Throws |
|
|---|
booleantrue if you want read only
SECURITY_LOW
SECURITY_CSRF
securityLevel :
controls : array
| var | |
|---|---|
| see |
array
rootControls : array
| var | |
|---|---|
| see |
array
submits : array
| var | |
|---|---|
| see |
array
uploads : array
| var | |
|---|---|
| see |
array
hiddens : array
| var | |
|---|---|
| see |
array
htmleditors : array
| var | |
|---|---|
| see |
array
wikieditors : array
| var | |
|---|---|
| see | |
| since |
array
builders : boolean
| var |
|---|
boolean
sel : string
| var |
|---|
string