XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
XoopsForm Class Reference
Inheritance diagram for XoopsForm:
XoopsGroupPermForm XoopsSimpleForm XoopsTableForm XoopsThemeForm

Public Member Functions

 __construct ($title, $name, $action, $method='post', $addtoken=false)
 
 XoopsForm ($title, $name, $action, $method='post', $addtoken=false)
 
 getTitle ()
 
 getName ()
 
 getAction ()
 
 getMethod ()
 
 addElement (&$formElement, $required=false)
 
getElements ($recurse=false)
 
 getElementNames ()
 
getElementByName ($name)
 
 setElementValue ($name, $value)
 
 setElementValues ($values)
 
getElementValue ($name)
 
getElementValues ()
 
 setExtra ($extra)
 
getExtra ()
 
 setRequired (&$formElement)
 
getRequired ()
 
 insertBreak ($extra=null)
 
 render ()
 
 display ()
 
 renderValidationJS ($withtags=true)
 
 assign (&$tpl)
 

Data Fields

 $_action
 
 $_method
 
 $_name
 
 $_title
 
 $_elements = []
 
 $_extra
 
 $_required = []
 

Detailed Description

Definition at line 14 of file form.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $title,
$name,
$action,
$method = 'post',
$addtoken = false )

#- constructor

Parameters
string$titletitle 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$addtokenwhether to add a security token to the form

Reimplemented in XoopsGroupPermForm.

Definition at line 72 of file form.php.

Member Function Documentation

◆ addElement()

addElement ( & $formElement,
$required = false )

Add an element to the form

Parameters
object&$formElementreference to a XoopsFormElement
bool$requiredis this a "required" element?

Definition at line 133 of file form.php.

◆ assign()

assign ( & $tpl)

assign to smarty form template instead of displaying directly

Parameters
object&$tplreference to a Smarty object
See also
Smarty

Definition at line 426 of file form.php.

◆ display()

display ( )

displays rendered form

Definition at line 362 of file form.php.

◆ getAction()

getAction ( )

get the "action" attribute for the <form> tag

Returns
string

Definition at line 112 of file form.php.

◆ getElementByName()

& getElementByName ( $name)

get a reference to a XoopsFormElement object by its "name"

Parameters
string$name"name" attribute assigned to a XoopsFormElement
Returns
object reference to a XoopsFormElement, false if not found

Definition at line 207 of file form.php.

◆ getElementNames()

getElementNames ( )

get an array of "name" attributes of form elements

Returns
array array of form element names

Definition at line 190 of file form.php.

◆ getElements()

& getElements ( $recurse = false)

get an array of forms elements

Parameters
boolget elements recursively?
Returns
array array of XoopsFormElements

Definition at line 159 of file form.php.

◆ getElementValue()

& getElementValue ( $name)

Gets the "value" attribute of a form element

Parameters
string$namethe "name" attribute of a form element
Returns
string the "value" attribute assigned to a form element, null if not set

Definition at line 260 of file form.php.

◆ getElementValues()

& getElementValues ( )

gets the "value" attribute of all form elements

Returns
array array of name/value pairs assigned to form elements

Definition at line 276 of file form.php.

◆ getExtra()

& getExtra ( )

get the extra attributes for the <form> tag

Returns
string

Definition at line 306 of file form.php.

◆ getMethod()

getMethod ( )

get the "method" attribute for the <form> tag

Returns
string

Definition at line 122 of file form.php.

◆ getName()

getName ( )

get the "name" attribute for the <form> tag

Returns
string

Definition at line 102 of file form.php.

◆ getRequired()

& getRequired ( )

get an array of "required" form elements

Returns
array array of XoopsFormElements

Definition at line 331 of file form.php.

◆ getTitle()

getTitle ( )

return the title of the form

Returns
string

Definition at line 92 of file form.php.

◆ insertBreak()

insertBreak ( $extra = null)

insert a break in the form

This method is abstract. It must be overwritten in the child classes.

Parameters
string$extraextra information for the break @abstract

Definition at line 344 of file form.php.

◆ render()

render ( )

returns renderered form

This method is abstract. It must be overwritten in the child classes.

@abstract

Reimplemented in XoopsGroupPermForm, XoopsSimpleForm, XoopsTableForm, and XoopsThemeForm.

Definition at line 355 of file form.php.

◆ renderValidationJS()

renderValidationJS ( $withtags = true)

Renders the Javascript function needed for client-side for validation

Parameters
bool$withtagsInclude the < javascript > tags in the returned string
Returns
string|null

Definition at line 373 of file form.php.

◆ setElementValue()

setElementValue ( $name,
$value )

Sets the "value" attribute of a form element

Parameters
string$namethe "name" attribute of a form element
string$valuethe "value" attribute of a form element

Definition at line 226 of file form.php.

◆ setElementValues()

setElementValues ( $values)

Sets the "value" attribute of form elements in a batch

Parameters
array$valuesarray of name/value pairs to be assigned to form elements

Definition at line 239 of file form.php.

◆ setExtra()

setExtra ( $extra)

set the extra attributes for the <form> tag

Parameters
string$extraextra attributes for the <form> tag

Definition at line 296 of file form.php.

◆ setRequired()

setRequired ( & $formElement)

make an element "required"

Parameters
object&$formElementreference to a XoopsFormElement

Definition at line 321 of file form.php.

◆ XoopsForm()

XoopsForm ( $title,
$name,
$action,
$method = 'post',
$addtoken = false )

Definition at line 82 of file form.php.

Field Documentation

◆ $_action

$_action

Definition at line 23 of file form.php.

◆ $_elements

$_elements = []

Definition at line 47 of file form.php.

◆ $_extra

$_extra

Definition at line 53 of file form.php.

◆ $_method

$_method

Definition at line 29 of file form.php.

◆ $_name

$_name

Definition at line 35 of file form.php.

◆ $_required

$_required = []

Definition at line 59 of file form.php.

◆ $_title

$_title

Definition at line 41 of file form.php.


The documentation for this class was generated from the following file: