Overview

Namespaces

  • None
  • Xmf
    • Database
    • Module
      • Helper
    • Template
  • Xoops
    • Auth
    • Core
      • Cache
      • Database
        • Logging
        • Schema
      • Exception
      • Handler
        • Scheme
      • Kernel
        • Dtype
        • Handlers
        • Model
      • Lists
      • Locale
        • Punic
      • Service
        • Contract
      • Session
      • Text
        • Sanitizer
          • Extensions
      • Theme
        • Plugins
    • Form
    • Html
    • Locale
    • Module
      • Helper
      • Plugin

Classes

  • BlockForm
  • Button
  • ButtonTray
  • Captcha
  • Checkbox
  • ColorPicker
  • DateSelect
  • DateTime
  • DhtmlTextArea
  • Editor
  • Element
  • ElementFactory
  • ElementTray
  • File
  • Form
  • GroupCheckbox
  • GroupFormCheckbox
  • GroupPermissionForm
  • Hidden
  • Label
  • Mail
  • OptionElement
  • Password
  • Radio
  • RadioYesNo
  • Raw
  • Select
  • SelectCountry
  • SelectEditor
  • SelectGroup
  • SelectLanguage
  • SelectLocale
  • SelectMatchOption
  • SelectTheme
  • SelectTimeZone
  • SelectUser
  • SimpleForm
  • Tab
  • TableForm
  • TabTray
  • Text
  • TextArea
  • ThemeForm
  • Token
  • Url

Interfaces

  • ContainerInterface
  • Overview
  • Namespace
  • Class
  • Tree

Class Form

Form - Abstract Form

Xoops\Form\Form implements Xoops\Form\ContainerInterface

Direct known subclasses

PublisherBlockForm, Xoops\Form\BlockForm, Xoops\Form\GroupPermissionForm, Xoops\Form\SimpleForm, Xoops\Form\TableForm, Xoops\Form\ThemeForm, XoopsForm

Indirect known subclasses

AvatarsAvatar_userForm, AvatarsAvatarForm, MaintenanceMaintenanceForm, MenusMenus_menuForm, MenusMenus_menusForm, PagePage_contentForm, PagePage_relatedForm, ProfileCategoryForm, ProfileFieldForm, ProfileRegstepForm, ProtectorCenterForm, PublisherCategoryForm, BannersBannerclientForm, PublisherFileForm, PublisherItemForm, SearchSearchForm, SmiliesSmiliesForm, SystemBlockForm, SystemGroupForm, SystemPreferencesForm, SystemUserForm, UserconfigsConfigsForm, UserconfigsModulesForm, BannersBannerForm, UserrankRanksForm, XcaptchaCaptchaForm, XcaptchaImageForm, XcaptchaRecaptchaForm, XcaptchaTextForm, XlanguageLanguageForm, XlanguageTinymceForm, XoopsGroupPermForm, XoopsSimpleForm, XoopsTableForm, CommentsCommentForm, XoopsThemeForm, ImagesCategory_imagemanagerForm, ImagesCategoryForm, ImagesCategoryselectForm, ImagesImage_imagemanagerForm, ImagesImageForm
Abstract
Namespace: Xoops\Form
Package: Xoops\Form
Category: Xoops\Form\Form
Copyright: 2001-2015 XOOPS Project (http://xoops.org)
License: GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
Author: Kazumi Ono onokazu@xoops.org
Author: Taiwen Jiang phppp@users.sourceforge.net
Link: http://xoops.org
Located at oops_lib/Xoops/Form/Form.php
Methods summary
public
# __construct( string $title, string $name, string $action, string $method = 'post', boolean $addtoken = false, string $display = '' )

constructor

constructor

Parameters

$title
title of the form
$name

name attribute for the

<

form> tag

$action

action attribute for the

<

form> tag

$method

method attribute for the

<

form> tag

$addtoken
whether to add a security token to the form
$display
class for the form, i.e. horizontal, vertical, inline
public string
# getDisplay( boolean $encode = false )

getDisplay - return the summary of the form

getDisplay - return the summary of the form

Parameters

$encode
True to encode special characters

Returns

string
public string
# getTitle( boolean $encode = false )

getTitle - return the title of the form

getTitle - return the title of the form

Parameters

$encode
To sanitizer the text?

Returns

string
public string
# setTitle( string $title )

setTitle

setTitle

Parameters

$title
form title

Returns

string
public string
# getName( boolean $encode = true )

get the "name" attribute for the

<

form> tag

get the "name" attribute for the

<

form> tag

Deprecated, to be refactored

Parameters

$encode
True to encode special characters

Returns

string
public
# setAction( string $value = '' )

setAction

setAction

Parameters

$value
URL of form action
public string
# getAction( boolean $encode = true )

getAction - get the "action" attribute for the

<

form> tag

getAction - get the "action" attribute for the

<

form> tag

Parameters

$encode
True to encode special characters

Returns

string
public string
# getMethod( )

getMethod - get the "method" attribute for the

<

form> tag

getMethod - get the "method" attribute for the

<

form> tag

Returns

string
public
# addElement( Xoops\Form\Element $formElement, boolean $required = false )

addElement - Add an element to the form

addElement - Add an element to the form

Parameters

$formElement
Xoops\Form\Element to add
$required
true if this is a required element

Implementation of

Xoops\Form\ContainerInterface::addElement()
public Xoops\Form\Element[]
# getElements( boolean $recurse = false )

getElements - get an array of forms elements

getElements - get an array of forms elements

Parameters

$recurse
true to get elements recursively

Returns

Xoops\Form\Element[]

Implementation of

Xoops\Form\ContainerInterface::getElements()
public string[]
# getElementNames( )

getElementNames - get an array of "name" attributes of form elements

getElementNames - get an array of "name" attributes of form elements

Returns

string[]
of form element names
public null|Xoops\Form\Element
# getElementByName( string $name )

getElementByName - get a reference to a Xoops\Form\Element by its name

getElementByName - get a reference to a Xoops\Form\Element by its name

Parameters

$name
name attribute assigned to a Xoops\Form\Element

Returns

null|Xoops\Form\Element
public
# setElementValue( string $name, string $value )

setElementValue - Sets the "value" attribute of a form element

setElementValue - Sets the "value" attribute of a form element

Parameters

$name
the "name" attribute of a form element
$value
the "value" attribute of a form element
public
# setElementValues( array $values )

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

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

Parameters

$values
array of name/value pairs to be assigned to form elements
public string|null
# getElementValue( string $name, boolean $encode = false )

getElementValue - Gets the value attribute of a form element

getElementValue - Gets the value attribute of a form element

Parameters

$name
the name attribute of a form element
$encode
True to encode special characters

Returns

string|null
the value attribute assigned to a form element, null if not set
public array
# getElementValues( boolean $encode = false )

getElementValues - gets the value attribute of all form elements

getElementValues - gets the value attribute of all form elements

Parameters

$encode
True to encode special characters

Returns

array
array of name/value pairs assigned to form elements
public
# setExtra( string $extra )

set the extra attributes for the

<

form> tag

set the extra attributes for the

<

form> tag

Parameters

$extra

extra attributes for the

<

form> tag

public string
# getExtra( )

getExtra - get the extra attributes for the

<

form> tag

getExtra - get the extra attributes for the

<

form> tag

Returns

string
public
# setRequired( Xoops\Form\Element $formElement )

setRequired - mark an element as required entry

setRequired - mark an element as required entry

Deprecated

set required attribute on element directly or when calling addElement

Parameters

$formElement
Xoops\Form\Element to set as required entry
public array
# getRequired( )

getRequired - get an array of required form elements

getRequired - get an array of required form elements

Returns

array
array of Xoops\Form\Element

Implementation of

Xoops\Form\ContainerInterface::getRequired()
abstract public string
# render( )

render - returns rendered form

render - returns rendered form

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

Returns

string
the rendered form
public
# display( )

display - displays rendered form

display - displays rendered form

public string
# renderValidationJS( boolean $withtags = true )

Renders the Javascript function needed for client-side for validation

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

$withtags
Include the < javascript > tags in the returned string

Returns

string
public
# assign( Xoops\Core\XoopsTpl $tpl )

assign - assign to smarty form template instead of displaying directly

assign - assign to smarty form template instead of displaying directly

Parameters

$tpl
template
Properties summary
protected string $action

"action" attribute for the html form

"action" attribute for the html form

#
protected string $method

"method" attribute for the form.

"method" attribute for the form.

#
protected string $name

"name" attribute of the form

"name" attribute of the form

#
protected string $title

title for the form

title for the form

#
protected string $display

display class for the form, i.e. horizontal, vertical, inline

display class for the form, i.e. horizontal, vertical, inline

# ''
protected Xoops\Form\Element[] $elements

array of Element objects

array of Element objects

# array()
protected string[] $extra

extra information for the

<

form> tag

extra information for the

<

form> tag

# array()
protected string[] $required

required elements

required elements

# array()
API documentation generated by ApiGen