API - XOOPS 2.5.11 Beta 2
By monxoops.fr
XoopsForm Class Reference
Inheritance diagram for XoopsForm:

Public Member Functions

 __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)
 

Data Fields

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

Constructor & Destructor Documentation

◆ __construct()

__construct (   $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
string$summary

Reimplemented in XoopsGroupPermForm.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ addElement()

addElement (   $formElement,
  $required = false 
)

Add an element to the form

Parameters
string | XoopsFormElement$formElementreference to a XoopsFormElement
bool$requiredis this a "required" element?
Here is the caller graph for this function:

◆ assign()

assign ( XoopsTpl  $tpl)

assign to smarty form template instead of displaying directly

Parameters
XoopsTpl$tplreference to a Smarty object object
See also
Smarty
Here is the call graph for this function:

◆ display()

display ( )

displays rendered form

Here is the call graph for this function:

◆ getAction()

getAction (   $encode = true)

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

Parameters
bool$encodeTo sanitizer the text?
Returns
string
Here is the caller graph for this function:

◆ getArrayID()

getArrayID (   $value,
  $key,
  $ret,
  $hashinfo = 'sha1' 
)
Parameters
$value
$key
$ret
string$hashinfo
Returns
string
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getClass()

& getClass ( )

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

Returns
string "class" attribute value

◆ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getElementNames()

getElementNames ( )

get an array of "name" attributes of form elements

Returns
array array of form element names
Here is the call graph for this function:

◆ getElements()

& getElements (   $recurse = false)

get an array of forms elements

Parameters
bool$recurseget elements recursively?
Returns
XoopsFormElement[] array of XoopsFormElements
Here is the caller graph for this function:

◆ getElementValue()

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
Here is the call graph for this function:

◆ getElementValues()

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
Here is the call graph for this function:

◆ getExtra()

& getExtra ( )

get the extra attributes for the <form> tag

Returns
string
Here is the caller graph for this function:

◆ getMethod()

getMethod ( )

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

Returns
string
Here is the caller graph for this function:

◆ getName()

getName (   $encode = true)

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

Deprecated, to be refactored

Parameters
bool$encodeTo sanitizer the text?
Returns
string
Here is the caller graph for this function:

◆ getObjectID()

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

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

each object has serialisation

  • legal requirement of enterprise relational management (ERM)

    Deprecated:
    @access public
    Parameters
    $object
    string$hashinfo
    Returns
    string
Here is the call graph for this function:

◆ getRequired()

& getRequired ( )

get an array of "required" form elements

Returns
array array of XoopsFormElements
Here is the caller graph for this function:

◆ getSummary()

getSummary (   $encode = false)

return the summary of the form

Parameters
bool$encodeTo sanitizer the text?
Returns
string

◆ getTitle()

getTitle (   $encode = false)

return the title of the form

Parameters
bool$encodeTo sanitizer the text?
Returns
string
Here is the caller graph for this function:

◆ 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

◆ 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.

Here is the caller graph for this function:

◆ 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$withtagsInclude the < javascript > tags in the returned string
Returns
string
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setClass()

setClass (   $class)

set the "class" attribute for the <form> tag

Parameters
string$class

◆ 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
Here is the call graph for this function:

◆ 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
Here is the call graph for this function:

◆ setExtra()

setExtra (   $extra)

set the extra attributes for the <form> tag

Parameters
string$extraextra attributes for the <form> tag

◆ setRequired()

setRequired ( XoopsFormElement  $formElement)

make an element "required"

Parameters
XoopsFormElement$formElementreference to a XoopsFormElement

◆ setSummary()

setSummary (   $summary)

set the summary tag for the <form> tag

Parameters
string$summary

◆ XoopsForm()

XoopsForm ( )

PHP 4 style constructor compatibility shim

Deprecated:
all callers should be using parent::__construct()
Here is the call graph for this function:

Field Documentation

◆ $_action

$_action

◆ $_class

$_class = array()

◆ $_elements

$_elements = array()

◆ $_extra

$_extra = array()

◆ $_method

$_method

◆ $_name

$_name

◆ $_objid

$_objid = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'

additional serialised object checksum (ERM Analysis - Requirement)

Deprecated:
@access private

◆ $_required

$_required = array()

◆ $_summary

$_summary = ''

◆ $_title

$_title

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