formdata
[ class tree: formdata ] [ index: formdata ] [ all elements ]

Class: FormValueSet

Source Location: /HtmlForm.FormValueSet.class.php

Class Overview


This class defines a container to hold gathered form-data.


Author(s):

  • Sebastian Schlapkohl

Version:

  • 1.0

Methods



Class Details

[line 27]
This class defines a container to hold gathered form-data.

The idea behind this is fairly simple: normally every form-widget has it's own exotic set of rules concerning the representation of it's values. A group of checkboxes for example not only returns nothing when not box is checked, but isn't even included in the resultset in that case. Considering that a multi-select, which is merely a different representation for this, is not only inlcuded, but also has a value (an empty array), this is quite bizarre.

A FormValueSet is supposed to streamline this, by applying the same rules to every value-bearing widget. When calling a FormValueSet for a form like $valueSet->htmlnameofwidget you should get the following defined answers: widget is not in form/is disabled => null widget is empty => '' or array() widget has selected value(s) => 'string' or Array(String, String, ...)

Widgets are supposed to return according values.

By this all voodoo-knowledge about when which widget returns what should be obsolete.




Tags:

author:  Sebastian Schlapkohl
version:  1.0


[ Top ]


Class Methods


constructor __construct [line 34]

FormValueSet __construct( )

Basic object constructor. Initializes with empty values.



Tags:

access:  public


[ Top ]

method setValue [line 51]

FormValueSet setValue( String $name, String $value)

Sets a value for a html-name in the resultset.

Value may only be null, an empty string, an empty array, a string or an array of strings.




Tags:

return:  method owner
access:  public


Parameters:

String   $name   html-name of the widget the value is gathered from
String   $value   the value-representation of the widget identified by the given name

[ Top ]

method __call [line 69]

null/String/Array[String] __call( String $name, [ $args = array()])

Magic method caller.

Enables value returns by calling a function of the required html-name. $valueSet->htmlnameofwidget()




Tags:

return:  value of the required widget
access:  public


Parameters:

String   $name   html-name of value to get
array   $args   obligatory second parameter for magic function

[ Top ]

method __get [line 84]

null/String/Array[String] __get( String $name)

Magic attribute getter.

Enables value returns by asking the FormValueSet for an attribute of the name of the required html-name. $valueSet->htmlnameofwidget




Tags:

return:  value of the required widget
access:  public


Parameters:

String   $name   html-name of value to get

[ Top ]


Documentation generated on Fri, 18 Jul 2014 16:32:01 +0200 by phpDocumentor 1.4.3