Overview

Packages

  • Auth
    • Ads
    • Ldap
    • Xoops
  • Autotasks
  • Config
    • Category
    • Item
    • Option
  • Core
    • Filesystem
    • Filters
    • Logger
    • Mail
    • Message
    • Password
    • Security
    • StopSpammer
    • Template
    • Textsanitizer
    • VersionChecker
  • Data
    • Avatar
    • Comment
  • Database
    • Connection
    • Criteria
    • Legacy
    • MySQL
    • PDO
    • Updater
  • Feeds
    • RSS
  • File
  • Form
    • Base
    • Elements
  • ICMS
    • IPF
      • View
  • Image
    • Category
  • Ipf
    • Category
    • Controller
    • Export
    • form
    • Keyhighlighter
    • Member
    • Object
    • Permission
    • richfile
    • Tree
    • urllink
    • View
  • kernel
    • Set
  • Member
    • Group
    • GroupMembership
    • GroupPermission
    • User
  • Messaging
  • Module
  • None
  • Notification
  • Page
  • Plugins
    • Editor
  • Preload
    • Libraries
  • Privmessage
  • Session
  • SmartObject
  • View
    • Block
    • Breadcrumb
    • PageNav
    • PrinterFriendly
    • Template
    • Templates
    • Theme
    • Tree

Classes

  • icms_form_Base
  • Overview
  • Package
  • Class

Class icms_form_Base

Abstract base class for forms

Direct known subclasses

icms_form_Groupperm, icms_form_Simple, icms_form_Table, icms_form_Theme

Indirect known subclasses

icms_ipf_form_Base, icms_ipf_form_Secure
Abstract
Package: Form\Base
Category: ICMS
Copyright: copyright (c) 2000-2007 XOOPS.org
License: GNU General Public License (GPL)
Author: Kazumi Ono onokazu@xoops.org
Author: Taiwen Jiang phppp@users.sourceforge.net
Located at form/Base.php
Methods summary
public
# __construct( string $title, string $name, string $action, string $method = "post", boolean $addtoken = false )

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
public string
# getTitle( boolean $encode = false )

return the title of the form

return the title of the form

Parameters

$encode
Would you like to sanitize the text?

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

Deprecated

The "name" attribute is not strict HTML

Parameters

$encode
To sanitizer the text?

Returns

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

get the "action" attribute for the

<

form> tag

get the "action" attribute for the

<

form> tag

Parameters

$encode
Would you like to sanitize the text?

Returns

string
public string
# getMethod( )

get the "method" attribute for the

<

form> tag

get the "method" attribute for the

<

form> tag

Returns

string
public
# addElement( object & $formElement, boolean $required = false )

Add an element to the form

Add an element to the form

Parameters

$formElement
$formElement reference to a icms_form_Element
$required
is this a "required" element?
public array &
# getElements( boolean $recurse = false )

get an array of forms elements

get an array of forms elements

Parameters

$recurse
elements recursively?

Returns

array
array of icms_form_Elements
public array
# getElementNames( )

get an array of "name" attributes of form elements

get an array of "name" attributes of form elements

Returns

array
array of form element names
public mixed &
# getElementByName( string $name )

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

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

Parameters

$name
"name" attribute assigned to a icms_form_Element

Returns

mixed
reference to a icms_form_Element, false if not found
public
# setElementValue( string $name, string $value )

Sets the "value" attribute of a form element

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 )

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

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
# getElementValue( string $name, boolean $encode = false )

Gets the "value" attribute of a form element

Gets the "value" attribute of a form element

Parameters

$name
the "name" attribute of a form element
$encode
To sanitizer the text?

Returns

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

gets the "value" attribute of all form elements

gets the "value" attribute of all form elements

Parameters

$encode
To sanitizer the text?

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

get the extra attributes for the

<

form> tag

get the extra attributes for the

<

form> tag

Returns

string
$extra
public
# setRequired( object & $formElement )

make an element "required"

make an element "required"

Parameters

$formElement
$formElement reference to a icms_form_Element
public array &
# getRequired( )

get an array of "required" form elements

get an array of "required" form elements

Returns

array
array of icms_form_Elements
abstract public
# insertBreak( string $extra = null )

insert a break in the form

insert a break in the form

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

Parameters

$extra
extra information for the break
abstract public
# render( )

returns renderered form

returns renderered form

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

public
# display( )

displays rendered form

displays rendered form

public
# 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
public
# assign( object & $tpl )

assign to smarty form template instead of displaying directly

assign to smarty form template instead of displaying directly

Parameters

$tpl
$tpl reference to a Smarty object

See

Smarty
Properties summary
protected array $_elements

array of icms_form_Element objects

array of icms_form_Element objects

# array()
API documentation generated by ApiGen