jFormsBase
__construct
(
string $sel,
&$container, [
boolean $reset =
false],
jFormsDataContainer $container)
-
string
$sel: the form selector
-
jFormsDataContainer
$container: the data container
-
boolean
$reset: says if the data should be reset
-
&$container
add a control to the form
void
addControl
($control $control)
-
$control
$control: jFormsControl
check validity of all data form
boolean
check
()
jFormsBuilderBase
getBuilder
(
string $buildertype,
string $action,
array $actionParams)
-
string
$buildertype: the type name of a form builder
-
string
$action: action selector where form will be submit
-
array
$actionParams: parameters for the action
-
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
()
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 $controlName, string $daoSelector, [mixed $primaryKey = null], [mixed $primaryKeyNames = null], [string $dbProfil = ''])
-
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
$dbProfil: the jDb profil to use with the dao
set form data from a DAO
void
initFromDao
(string $daoSelector, [string $key = null], [string $dbProfil = ''])
-
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
$dbProfil: the jDb profil to use with the dao
set form data from request parameters
void
initFromRequest
()
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 $dbProfil = ''])
-
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
$dbProfil: the jDb profil 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 $dbProfil = ''])
-
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
$dbProfil: the jDb profil 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
method not implemented...
void
setReadOnly
([boolean $r = true])