Detailed Description

input element base class

The abstract class input containѕ the intersections of all implemented HTML input element types. It handles validation and value manipulation.

Definition at line 20 of file input.php.

Inheritance diagram for input:

Public Member Functions

 __construct ($name, $parameters, $form)
 input class constructor More...
 
 validate ()
 Validates input element. More...
 
 isEmpty ()
 says wether the element value is empty More...
 
 setValue ($newValue)
 set the input element value More...
 
 getValue ()
 Returns the current input elements' value. More...
 
 getLabel ()
 Returns the current input elements' label. More...
 
 clearValue ()
 resets the value to null More...
 
 setDefaultValue ($newDefaultValue)
 set the initial input element value More...
 
 setAutofocus ($autofocus=true)
 Sets the HTML autofocus-attribute of the current input element. More...
 
 setRequired ($required=true)
 Sets the HTML required-attribute of the current input element. More...
 
 setDisabled ($disabled=true)
 Sets the HTML disabled-attribute of the current input element. More...
 
- Public Member Functions inherited from element
 __construct ($name, $parameters, $form)
 element class constructor More...
 
 __call ($function, $arguments)
 HTML escaping. More...
 
 clearValue ()
 resets the value to null More...
 
 getName ()
 Returns the element name. More...
 

Protected Member Functions

 setDefaults ()
 Sets the default values for input elements. More...
 
 validatorCall ()
 custom validator call hook More...
 
 typeCastValue ()
 converts element value More...
 
 htmlClasses ()
 Returns string of the elements' HTML-classes, separated by spaces. More...
 
 htmlMarker ()
 Returns elements' required-indicator. More...
 
 htmlInputAttributes ()
 Returns string of HTML attributes for input element. More...
 
 htmlWrapperAttributes ()
 Returns string of HTML attributes for element wrapper paragraph. More...
 
 htmlValue ()
 Returns HTML-rendered element value. More...
 
 htmlErrorMessage ()
 Returns HTML-rendered error message. More...
 
 htmlHelpMessage ()
 Returns HTML-rendered helpMessage. More...
 
- Protected Member Functions inherited from element
 setDefaults ()
 Collects initial values across subclasses. More...
 
 checkParameters ($parameters)
 checks element parameters More...
 
 log ($argument, $type=null)
 error & warning logger More...
 
 htmlEscape ($options=array())
 Escapes HTML in strings and arrays of strings. More...
 

Protected Attributes

 $type
 Input element type - HTML input type attribute. More...
 
 $label
 Input element - HTML label. More...
 
 $marker
 Input element - HTML marker text that marks required fields. More...
 
 $required
 True if the input element is required to hold a value to be valid. More...
 
 $disabled
 wether a input element will be disabled More...
 
 $formName
 Name of the parent HTML form. Used to identify the element once it's rendered. More...
 
 $value = null
 Input elements's value. More...
 
 $validator
 Holds validator object reference. More...
 
 $class
 class for paragraph More...
 
 $classes
 HTML classes attribute for rendering the input element. More...
 
 $autofocus = false
 HTML autofocus attribute. More...
 
 $autocapitalize
 HTML autocapitalize attribute. More...
 
 $autocorrect
 HTML autocorrect attribute. More...
 
 $autocomplete
 HTML autocomplete attribute. More...
 
 $pattern
 HTML pattern attribute. More...
 
 $errorMessage
 Message that gets displayed in case of invalid input. More...
 
 $helpMessage
 Extra help message. More...
 
 $helpMessageHtml
 Extra hep message in html format. More...
 
- Protected Attributes inherited from element
 $name
 Element name. More...
 
 $validated = false
 True if the element has been validated before. More...
 
 $log
 Log object reference. More...
 

Additional Inherited Members

- Data Fields inherited from element
 $valid
 Contains element validation status/result. More...
 

Constructor & Destructor Documentation

__construct (   $name,
  $parameters,
  $form 
)

input class constructor

Parameters
string$nameinput element name
array$parametersinput element parameters, HTML attributes, validator specs etc.
object$formparent form object
Returns
void

Definition at line 207 of file input.php.

Member Function Documentation

clearValue ( )

resets the value to null

Returns
void

Definition at line 344 of file input.php.

getLabel ( )

Returns the current input elements' label.

Returns
$this->label HTML label

Definition at line 334 of file input.php.

getValue ( )

Returns the current input elements' value.

Returns
mixed $this->value input element value

Definition at line 324 of file input.php.

htmlClasses ( )
protected

Returns string of the elements' HTML-classes, separated by spaces.

Returns
string $classes HTML-classes

Definition at line 414 of file input.php.

htmlErrorMessage ( )
protected

Returns HTML-rendered error message.

Returns
string $errorMessage HTML-rendered error message

Definition at line 514 of file input.php.

htmlHelpMessage ( )
protected

Returns HTML-rendered helpMessage.

Returns
string $helpMessage HTML-rendered helpMessage span

Definition at line 533 of file input.php.

htmlInputAttributes ( )
protected

Returns string of HTML attributes for input element.

Returns
string $attributes HTML attribute

Definition at line 455 of file input.php.

htmlMarker ( )
protected

Returns elements' required-indicator.

If the current input element is set required it returns the marker. Otherwise an empty string.

Returns
string $this->marker marker or empty string

Definition at line 445 of file input.php.

htmlValue ( )
protected

Returns HTML-rendered element value.

Returns
mixed element value

Definition at line 504 of file input.php.

htmlWrapperAttributes ( )
protected

Returns string of HTML attributes for element wrapper paragraph.

Returns
string $attributes HTML attribute

Definition at line 486 of file input.php.

isEmpty ( )

says wether the element value is empty

Checks wether the input element value is empty. Accepts '0' and false as not empty.

Returns
bool empty-check result

Definition at line 290 of file input.php.

setAutofocus (   $autofocus = true)

Sets the HTML autofocus-attribute of the current input element.

Parameters
$autofocus(bool) HTML autofocus-attribute
Returns
void

Definition at line 381 of file input.php.

setDefaults ( )
protected

Sets the default values for input elements.

The constructor loops through these and creates settable class attributes at runtime. It's a compact mechanism for initialising a lot of variables.

Returns
void

Definition at line 228 of file input.php.

setDefaultValue (   $newDefaultValue)

set the initial input element value

Since the actual іnput value has to be null initially (for validation purposes) the user can manually set the default value here.

Parameters
mixed$newDefaultValuenew value
Returns
void
See Also
htmlValue()

Definition at line 360 of file input.php.

setDisabled (   $disabled = true)

Sets the HTML disabled-attribute of the current input element.

Parameters
bool$disabledHTML disabled-attribute
Returns
void

Definition at line 404 of file input.php.

setRequired (   $required = true)

Sets the HTML required-attribute of the current input element.

Parameters
bool$requiredHTML required-attribute
Returns
void

Definition at line 392 of file input.php.

setValue (   $newValue)

set the input element value

Sets the current input elements value. Additionally performs typecasting to element specific datatype.

Parameters
mixed$newValuenew value
Returns
mixed $this->value typecasted new value
See Also
typeCastValue()

Definition at line 310 of file input.php.

typeCastValue ( )
protected

converts element value

Converts value to element specific datatype. (to be overridden by element child classes)

Returns
void

Definition at line 373 of file input.php.

validate ( )

Validates input element.

Checks if the value the current input element holds is valid according to it's validator object.

Returns
bool $this->valid validation result

Definition at line 255 of file input.php.

validatorCall ( )
protected

custom validator call hook

Hook method for validator call. Validator arguments can be adjusted on override.

Returns
bool validation result

Definition at line 277 of file input.php.

Field Documentation

$autocapitalize
protected

HTML autocapitalize attribute.

Definition at line 135 of file input.php.

$autocomplete
protected

HTML autocomplete attribute.

Definition at line 157 of file input.php.

$autocorrect
protected

HTML autocorrect attribute.

Definition at line 147 of file input.php.

$autofocus = false
protected

HTML autofocus attribute.

Definition at line 124 of file input.php.

$class
protected

class for paragraph

Definition at line 107 of file input.php.

$classes
protected

HTML classes attribute for rendering the input element.

Definition at line 112 of file input.php.

$disabled
protected

wether a input element will be disabled

Definition at line 69 of file input.php.

$errorMessage
protected

Message that gets displayed in case of invalid input.

Definition at line 173 of file input.php.

$formName
protected

Name of the parent HTML form. Used to identify the element once it's rendered.

Definition at line 74 of file input.php.

$helpMessage
protected

Extra help message.

Definition at line 185 of file input.php.

$helpMessageHtml
protected

Extra hep message in html format.

Definition at line 197 of file input.php.

$label
protected

Input element - HTML label.

Definition at line 36 of file input.php.

$marker
protected

Input element - HTML marker text that marks required fields.

Definition at line 47 of file input.php.

$pattern
protected

HTML pattern attribute.

Definition at line 162 of file input.php.

$required
protected

True if the input element is required to hold a value to be valid.

Definition at line 58 of file input.php.

$type
protected

Input element type - HTML input type attribute.

Definition at line 25 of file input.php.

$validator
protected

Holds validator object reference.

Definition at line 96 of file input.php.

$value = null
protected

Input elements's value.

Definition at line 79 of file input.php.


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