[ Index ]
 

Code source de XOOPS 2.0.17.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/htdocs/class/xoopsform/ -> form.php (sommaire)

(pas de description)

Author: Kazumi Ono <onokazu@xoops.org>
Copyright: copyright (c) 2000-2003 XOOPS.org
Poids: 449 lignes (13 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

XoopsForm:: (22 méthodes):
  XoopsForm()
  getTitle()
  getName()
  getAction()
  getMethod()
  addElement()
  getElements()
  getElementNames()
  getElementByName()
  setElementValue()
  setElementValues()
  getElementValue()
  getElementValues()
  setExtra()
  getExtra()
  setRequired()
  getRequired()
  insertBreak()
  render()
  display()
  renderValidationJS()
  assign()


Classe: XoopsForm  - X-Ref

Abstract base class for forms

XoopsForm($title, $name, $action, $method="post", $addtoken=false)   X-Ref
constructor

param: string  $title  title of the form
param: string  $name   "name" attribute for the <form> tag
param: string  $action "action" attribute for the <form> tag
param: string  $method "method" attribute for the <form> tag
param: bool    $addtoken whether to add a security token to the form

getTitle()   X-Ref
return the title of the form

return: string

getName()   X-Ref
get the "name" attribute for the <form> tag

return: string

getAction()   X-Ref
get the "action" attribute for the <form> tag

return: string

getMethod()   X-Ref
get the "method" attribute for the <form> tag

return: string

addElement(&$formElement, $required = false)   X-Ref
Add an element to the form

param: object  &$formElement    reference to a {@link XoopsFormElement}
param: bool    $required       is this a "required" element?

getElements($recurse = false)   X-Ref
get an array of forms elements

param: bool    get elements recursively?
return: array   array of {@link XoopsFormElement}s

getElementNames()   X-Ref
get an array of "name" attributes of form elements

return: array   array of form element names

getElementByName($name)   X-Ref
get a reference to a {@link XoopsFormElement} object by its "name"

param: string  $name    "name" attribute assigned to a {@link XoopsFormElement}
return: object  reference to a {@link XoopsFormElement}, false if not found

setElementValue($name, $value)   X-Ref
Sets the "value" attribute of a form element

param: string $name    the "name" attribute of a form element
param: string $value    the "value" attribute of a form element

setElementValues($values)   X-Ref
Sets the "value" attribute of form elements in a batch

param: array $values    array of name/value pairs to be assigned to form elements

getElementValue($name)   X-Ref
Gets the "value" attribute of a form element

param: string     $name    the "name" attribute of a form element
return: string     the "value" attribute assigned to a form element, null if not set

getElementValues()   X-Ref
gets the "value" attribute of all form elements

return: array     array of name/value pairs assigned to form elements

setExtra($extra)   X-Ref
set the extra attributes for the <form> tag

param: string  $extra  extra attributes for the <form> tag

getExtra()   X-Ref
get the extra attributes for the <form> tag

return: string

setRequired(&$formElement)   X-Ref
make an element "required"

param: object  &$formElement    reference to a {@link XoopsFormElement}

getRequired()   X-Ref
get an array of "required" form elements

return: array   array of {@link XoopsFormElement}s

insertBreak($extra = null)   X-Ref
insert a break in the form

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

param: string  $extra  extra information for the break

render()   X-Ref
returns renderered form

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


display()   X-Ref
displays rendered form


renderValidationJS( $withtags = true )   X-Ref
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 <i>return false</i> if validation fails.

A basic element validation method may contain something like this:
<code>
function renderValidationJS() {
$name = $this->getName();
return "if ( myform.{$name}.value != 'valid' ) { " .
"myform.{$name}.focus(); window.alert( '$name is invalid' ); return false;" .
" }";
}
</code>

param: boolean  $withtags    Include the < javascript > tags in the returned string

assign(&$tpl)   X-Ref
assign to smarty form template instead of displaying directly

param: object  &$tpl    reference to a {@link Smarty} object



Généré le : Sun Nov 25 11:44:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics