XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
XoopsForm Class Reference
Inheritance diagram for XoopsForm:
Inheritance graph

Public Member Functions

 addElement (&$formElement, $required=false)
 
 assign (&$tpl)
 
 display ()
 
 getAction ($encode=true)
 
 getArrayID ($value, $key, $ret, $hashinfo= 'sha1')
 
getElementByName ($name)
 
 getElementNames ()
 
getElements ($recurse=false)
 
 getElementValue ($name, $encode=false)
 
 getElementValues ($encode=false)
 
getExtra ()
 
 getMethod ()
 
 getName ($encode=true)
 
 getObjectID ($object, $hashinfo= 'sha1')
 
getRequired ()
 
 getSummary ($encode=false)
 
 getTitle ($encode=false)
 
 insertBreak ($extra=null)
 
 render ()
 
 renderValidationJS ($withtags=true)
 
 setElementValue ($name, $value)
 
 setElementValues ($values)
 
 setExtra ($extra)
 
 setRequired (&$formElement)
 
 setSummary ($summary)
 
 XoopsForm ($title, $name, $action, $method= 'post', $addtoken=false, $summary= '')
 

Public Attributes

 $_action
 
 $_elements = array()
 
 $_extra = array()
 
 $_method
 
 $_name
 
 $_objid = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
 
 $_required = array()
 
 $_summary = ''
 
 $_title
 

Detailed Description

Definition at line 32 of file form.php.

Member Function Documentation

XoopsForm::addElement ( $formElement,
  $required = false 
)

Add an element to the form

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

Definition at line 262 of file form.php.

References $i.

XoopsForm::assign ( $tpl)

assign to smarty form template instead of displaying directly

Parameters
object$ &$tpl reference to a Smarty object
See Also
Smarty

Definition at line 555 of file form.php.

References $i, $js, $tpl, and _REQUIRED.

XoopsForm::display ( )

displays rendered form

Definition at line 501 of file form.php.

XoopsForm::getAction (   $encode = true)

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

Parameters
bool$encodeTo sanitizer the text?
Returns
string

Definition at line 240 of file form.php.

XoopsForm::getArrayID (   $value,
  $key,
  $ret,
  $hashinfo = 'sha1' 
)

Definition at line 176 of file form.php.

References $ret.

& XoopsForm::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 336 of file form.php.

References $i.

XoopsForm::getElementNames ( )

get an array of "name" attributes of form elements

Returns
array array of form element names

Definition at line 319 of file form.php.

References $i, and $ret.

& XoopsForm::getElements (   $recurse = false)

get an array of forms elements

Parameters
bool$ get elements recursively?
Returns
array array of XoopsFormElements

Definition at line 289 of file form.php.

References $i, $j, and $ret.

XoopsForm::getElementValue (   $name,
  $encode = false 
)

Gets the "value" attribute of a form element

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

Definition at line 390 of file form.php.

XoopsForm::getElementValues (   $encode = false)

gets the "value" attribute of all form elements

Parameters
bool$encodeTo sanitizer the text?
Returns
array array of name/value pairs assigned to form elements

Definition at line 405 of file form.php.

References $i.

& XoopsForm::getExtra ( )

get the extra attributes for the <form> tag

Returns
string

Definition at line 449 of file form.php.

XoopsForm::getMethod ( )

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

Returns
string

Definition at line 251 of file form.php.

XoopsForm::getName (   $encode = true)

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

Deprecated, to be refactored

Parameters
bool$encodeTo sanitizer the text?
Returns
string

Definition at line 229 of file form.php.

XoopsForm::getObjectID (   $object,
  $hashinfo = 'sha1' 
)

*#@+ retrieves object serialisation/identification id (sha1 used)

each object has serialisation

  • legal requirement of enterprise relational management (ERM)
Deprecated:
public

Definition at line 138 of file form.php.

References $var.

& XoopsForm::getRequired ( )

get an array of "required" form elements

Returns
array array of XoopsFormElements

Definition at line 470 of file form.php.

XoopsForm::getSummary (   $encode = false)

return the summary of the form

Parameters
bool$encodeTo sanitizer the text?
Returns
string

Definition at line 205 of file form.php.

XoopsForm::getTitle (   $encode = false)

return the title of the form

Parameters
bool$encodeTo sanitizer the text?
Returns
string

Definition at line 216 of file form.php.

XoopsForm::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

Definition at line 483 of file form.php.

XoopsForm::render ( )

returns renderered form

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

Definition at line 494 of file form.php.

XoopsForm::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$withtagsInclude the < javascript > tags in the returned string

Definition at line 528 of file form.php.

References $js.

XoopsForm::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 355 of file form.php.

XoopsForm::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 368 of file form.php.

References $i.

XoopsForm::setExtra (   $extra)

set the extra attributes for the <form> tag

Parameters
string$extraextra attributes for the <form> tag

Definition at line 425 of file form.php.

XoopsForm::setRequired ( $formElement)

make an element "required"

Parameters
object$ &$formElement reference to a XoopsFormElement

Definition at line 460 of file form.php.

XoopsForm::setSummary (   $summary)

set the summary tag for the <form> tag

Parameters
string$extraextra attributes for the <form> tag

Definition at line 437 of file form.php.

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

*#@- 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

Definition at line 116 of file form.php.

References $action, $method, and $title.

Member Data Documentation

XoopsForm::$_action

Definition at line 44 of file form.php.

XoopsForm::$_elements = array()

Definition at line 79 of file form.php.

XoopsForm::$_extra = array()

Definition at line 86 of file form.php.

XoopsForm::$_method

Definition at line 51 of file form.php.

XoopsForm::$_name

Definition at line 58 of file form.php.

XoopsForm::$_objid = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'

additional seralised object checksum (ERM Analysis - Requirement)

Deprecated:
private

Definition at line 101 of file form.php.

XoopsForm::$_required = array()

Definition at line 93 of file form.php.

XoopsForm::$_summary = ''

Definition at line 72 of file form.php.

XoopsForm::$_title

Definition at line 65 of file form.php.


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