Abstract base class for forms
Methods | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
public
|
__construct(
string $title,
string $name,
string $action,
string $method = 'post',
bool $addtoken = false,
string $summary = '',
)
constructor
constructor Parameters
Overriden by |
# | ||||||||||
public
|
XoopsForm()
PHP 4 style constructor compatibility shim
PHP 4 style constructor compatibility shim Deprecatedall callers should be using parent::__construct() |
# | ||||||||||
public
|
getObjectID(mixed $object, string $hashinfo = 'sha1'): string
*#@+
retrieves object serialization/identification id (sha1 used)
*#@+ retrieves object serialization/identification id (sha1 used) each object has serialization
Parameters
ReturnsThe serialization ID |
# | ||||||||||
public
|
getArrayID(mixed $value, mixed $key, string $ret, string $hashinfo = 'sha1'): string
|
# | ||||||||||
public
|
getSummary(bool $encode = false): string
return the summary of the form
return the summary of the form Parameters
|
# | ||||||||||
public
|
getTitle(bool $encode = false): string
return the title of the form
return the title of the form Parameters
|
# | ||||||||||
public
|
getName(bool $encode = true): string
get the "name" attribute for the <form> tag
get the "name" attribute for the Parameters
|
# | ||||||||||
public
|
getAction(bool $encode = true): string
get the "action" attribute for the <form> tag
get the "action" attribute for the Parameters
|
# | ||||||||||
public
|
getMethod(): string
get the "method" attribute for the <form> tag
get the "method" attribute for the |
# | ||||||||||
public
|
addElement(string|XoopsFormElement $formElement, bool $required = false)
Add an element to the form
Add an element to the form Parameters
|
# | ||||||||||
public
&
|
getElements(bool $recurse = false): XoopsFormElement[]
get an array of forms elements
get an array of forms elements Parameters
Returnsarray of {@link XoopsFormElement}s |
# | ||||||||||
public
|
getElementNames(): array
get an array of "name" attributes of form elements
get an array of "name" attributes of form elements Returnsarray of form element names |
# | ||||||||||
public
&
|
getElementByName(string $name): object
get a reference to a {@link XoopsFormElement} object by its "name"
get a reference to a {@link XoopsFormElement} object by its "name" Parameters
Returnsreference to a {@link XoopsFormElement}, false if not found |
# | ||||||||||
public
|
setElementValue(string $name, string $value)
Sets the "value" attribute of a form element
Sets the "value" attribute of a form element Parameters
|
# | ||||||||||
public
|
setElementValues(array $values)
Sets the "value" attribute of form elements in a batch
Sets the "value" attribute of form elements in a batch Parameters
|
# | ||||||||||
public
|
getElementValue(string $name, bool $encode = false): string
Gets the "value" attribute of a form element
Gets the "value" attribute of a form element Parameters
Returnsthe "value" attribute assigned to a form element, null if not set |
# | ||||||||||
public
|
getElementValues(bool $encode = false): array
gets the "value" attribute of all form elements
gets the "value" attribute of all form elements Parameters
Returnsarray of name/value pairs assigned to form elements |
# | ||||||||||
public
|
setClass(string $class)
set the "class" attribute for the <form> tag
set the "class" attribute for the |
# | ||||||||||
public
|
setExtra(string $extra)
set the extra attributes for the <form> tag
set the extra attributes for the Parameters
|
# | ||||||||||
public
|
setSummary(string $summary)
set the summary tag for the <form> tag
set the summary tag for the |
# | ||||||||||
public
&
|
getClass(): string
get the "class" attribute for the <form> tag
get the "class" attribute for the Returns"class" attribute value |
# | ||||||||||
public
&
|
getExtra(): string
get the extra attributes for the <form> tag
get the extra attributes for the |
# | ||||||||||
public
|
setRequired(XoopsFormElement $formElement)
make an element "required"
make an element "required" Parameters
|
# | ||||||||||
public
&
|
getRequired(): array
get an array of "required" form elements
get an array of "required" form elements Returnsarray of {@link XoopsFormElement}s |
# | ||||||||||
public
|
insertBreak(string $extra = null)
insert a break in the form
insert a break in the form This method is abstract. It must be overwritten in the child classes. Parameters
Overriden by |
# | ||||||||||
public
|
render()
returns renderered form
returns renderered form This method is abstract. It must be overwritten in the child classes. Overriden by |
# | ||||||||||
public
|
display()
displays rendered form
displays rendered form |
# | ||||||||||
public
|
renderValidationJS(boolean $withtags = true): string
Renders the Javascript function needed for client-side for validation
Renders the Javascript function needed for client-side for validation Form elements that have been declared "required" and not set will prevent the form from being submitted. Additionally, each element class may provide its own "renderValidationJS" method that is supposed to return custom validation code for the element. The element validation code can assume that the JS "myform" variable points to the form, and must execute return false if validation fails. A basic element validation method may contain something like this:
Parameters
|
# | ||||||||||
public
|
assign(XoopsTpl $tpl)
assign to smarty form template instead of displaying directly
assign to smarty form template instead of displaying directly Parameters
|
# |
Properties | |||
---|---|---|---|
public
|
string
|
$_action
|
# |
public
|
string
|
$_method
|
# |
public
|
string
|
$_name
|
# |
public
|
string
|
$_title
|
# |
public
|
string
|
$_summary = ''
|
# |
public
|
array
|
$_elements = []
|
# |
public
|
array
|
$_class = []
|
# |
public
|
array
|
$_extra = []
|
# |
public
|
array
|
$_required = []
|
# |
public
|
|
$_objid = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
additional serialized object checksum (ERM Analysis - Requirement)
additional serialized object checksum (ERM Analysis - Requirement) |
# |