|
| __construct ($title, $name, $action, $method='post', $addtoken=false, $summary='') |
|
| XoopsForm () |
|
| getObjectID ($object, $hashinfo='sha1') |
|
| getArrayID ($value, $key, $ret, $hashinfo='sha1') |
|
| getSummary ($encode=false) |
|
| getTitle ($encode=false) |
|
| getName ($encode=true) |
|
| getAction ($encode=true) |
|
| getMethod () |
|
| addElement ($formElement, $required=false) |
|
& | getElements ($recurse=false) |
|
| getElementNames () |
|
& | getElementByName ($name) |
|
| setElementValue ($name, $value) |
|
| setElementValues ($values) |
|
| getElementValue ($name, $encode=false) |
|
| getElementValues ($encode=false) |
|
| setClass ($class) |
|
| setExtra ($extra) |
|
| setSummary ($summary) |
|
& | getClass () |
|
& | getExtra () |
|
| setRequired (XoopsFormElement $formElement) |
|
& | getRequired () |
|
| insertBreak ($extra=null) |
|
| render () |
|
| display () |
|
| renderValidationJS ($withtags=true) |
|
| assign (XoopsTpl $tpl) |
|
◆ __construct()
__construct |
( |
|
$title, |
|
|
|
$name, |
|
|
|
$action, |
|
|
|
$method = 'post' , |
|
|
|
$addtoken = false , |
|
|
|
$summary = '' |
|
) |
| |
*#- constructor
- Parameters
-
string | $title | title of the form |
string | $name | "name" attribute for the <form> tag |
string | $action | "action" attribute for the <form> tag |
string | $method | "method" attribute for the <form> tag |
bool | $addtoken | whether to add a security token to the form |
string | $summary | |
Reimplemented in XoopsGroupPermForm.
◆ addElement()
addElement |
( |
|
$formElement, |
|
|
|
$required = false |
|
) |
| |
Add an element to the form
- Parameters
-
◆ assign()
assign to smarty form template instead of displaying directly
- Parameters
-
- See also
- Smarty
◆ display()
◆ getAction()
getAction |
( |
|
$encode = true | ) |
|
get the "action" attribute for the <form> tag
- Parameters
-
bool | $encode | To sanitizer the text? |
- Returns
- string
◆ getArrayID()
getArrayID |
( |
|
$value, |
|
|
|
$key, |
|
|
|
$ret, |
|
|
|
$hashinfo = 'sha1' |
|
) |
| |
- Parameters
-
| $value | |
| $key | |
| $ret | |
string | $hashinfo | |
- Returns
- string
◆ getClass()
get the "class" attribute for the <form> tag
- Returns
- string "class" attribute value
◆ getElementByName()
& getElementByName |
( |
|
$name | ) |
|
◆ getElementNames()
get an array of "name" attributes of form elements
- Returns
- array array of form element names
◆ getElements()
& getElements |
( |
|
$recurse = false | ) |
|
◆ getElementValue()
getElementValue |
( |
|
$name, |
|
|
|
$encode = false |
|
) |
| |
Gets the "value" attribute of a form element
- Parameters
-
string | $name | the "name" attribute of a form element |
bool | $encode | To sanitizer the text? |
- Returns
- string the "value" attribute assigned to a form element, null if not set
◆ getElementValues()
getElementValues |
( |
|
$encode = false | ) |
|
gets the "value" attribute of all form elements
- Parameters
-
bool | $encode | To sanitizer the text? |
- Returns
- array array of name/value pairs assigned to form elements
◆ getExtra()
get the extra attributes for the <form> tag
- Returns
- string
◆ getMethod()
get the "method" attribute for the <form> tag
- Returns
- string
◆ getName()
getName |
( |
|
$encode = true | ) |
|
get the "name" attribute for the <form> tag
Deprecated, to be refactored
- Parameters
-
bool | $encode | To sanitizer the text? |
- Returns
- string
◆ getObjectID()
getObjectID |
( |
|
$object, |
|
|
|
$hashinfo = 'sha1' |
|
) |
| |
*#+ retrieves object serialisation/identification id (sha1 used)
each object has serialisation
◆ getRequired()
get an array of "required" form elements
- Returns
- array array of
XoopsFormElement
s
◆ getSummary()
getSummary |
( |
|
$encode = false | ) |
|
return the summary of the form
- Parameters
-
bool | $encode | To sanitizer the text? |
- Returns
- string
◆ getTitle()
getTitle |
( |
|
$encode = false | ) |
|
return the title of the form
- Parameters
-
bool | $encode | To sanitizer the text? |
- Returns
- string
◆ insertBreak()
insertBreak |
( |
|
$extra = null | ) |
|
insert a break in the form
This method is abstract. It must be overwritten in the child classes.
- Parameters
-
string | $extra | extra information for the break @abstract |
◆ render()
◆ renderValidationJS()
renderValidationJS |
( |
|
$withtags = true | ) |
|
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: function renderValidationJS() { $name = $this->getName(); return "if (myform.{$name}.value != 'valid') { " . "myform.{$name}.focus(); window.alert( '$name is invalid' ); return false;" . " }"; }
- Parameters
-
boolean | $withtags | Include the < javascript > tags in the returned string |
- Returns
- string
◆ setClass()
set the "class" attribute for the <form> tag
- Parameters
-
◆ setElementValue()
setElementValue |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Sets the "value" attribute of a form element
- Parameters
-
string | $name | the "name" attribute of a form element |
string | $value | the "value" attribute of a form element |
◆ setElementValues()
setElementValues |
( |
|
$values | ) |
|
Sets the "value" attribute of form elements in a batch
- Parameters
-
array | $values | array of name/value pairs to be assigned to form elements |
◆ setExtra()
set the extra attributes for the <form> tag
- Parameters
-
string | $extra | extra attributes for the <form> tag |
◆ setRequired()
make an element "required"
- Parameters
-
◆ setSummary()
set the summary tag for the <form> tag
- Parameters
-
◆ XoopsForm()
PHP 4 style constructor compatibility shim
- Deprecated:
- all callers should be using parent::__construct()
◆ $_action
◆ $_class
◆ $_elements
◆ $_extra
◆ $_method
◆ $_name
◆ $_objid
$_objid = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' |
additional serialised object checksum (ERM Analysis - Requirement)
- Deprecated:
- @access private
◆ $_required
◆ $_summary
◆ $_title
The documentation for this class was generated from the following file:
- C:/xoops2511b2/htdocs/class/xoopsform/form.php