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

Class: InputText

Source Location: /HtmlForm.FormElement.InputText.class.php

Class Overview

FormElement
   |
   --InputText

Wraps a standard text-input.


Author(s):

  • Sebastian Schlapkohl

Version:

  • 1.0

Variables

Methods


Child classes:

InputFile
Wraps a file-upload text-input.
InputPassword
Wraps a password-text-input.
JsDateTime
Wraps a standard text-input adapted and expanded to work as a date-time-picker.

Inherited Constants

Inherited Variables

Inherited Methods

Class: FormElement

FormElement::__construct()
General abstract, hidden formelement constructor.
FormElement::addCssClasses()
Adds one or many css-classes to the element's class-attribute.
FormElement::addElement()
Adds a subelement to the element.
FormElement::determineRefiller()
Returns the supposed source of refill values.
FormElement::doRender()
Returns the compiled html-code for the element.
FormElement::getId()
Return the element's html-id.
FormElement::getLabel()
Return the element's label text.
FormElement::getMasterElement()
Return the currently connected owner element for the element.
FormElement::getMasterForm()
Returns the currently connected owner form for the element.
FormElement::getName()
Return the element's html-name.
FormElement::getSubElements()
Return all owned elements of this element.
FormElement::getTitle()
Return the element's html-title.
FormElement::getValidator()
Return the currently connected validator for the element.
FormElement::getValue()
Returns the value of the element if there is any.
FormElement::getValueSet()
Returns the compiled valueset for this element including the elements owned by this one.
FormElement::insertElementAfter()
Searches the subelements of the element if present and inserts a given element after the first found one.
FormElement::isValid()
Answers if the element is in a valid state at the moment.
FormElement::needsUtf8Safety()
Answers if the element needs to be treated with precautions according to possible utf-8 values.
FormElement::printCssClasses()
Compiles the html-class-attribute-string of the element.
FormElement::printDisabled()
Compiles the html-disabled-attribute-string of the element.
FormElement::printId()
Compiles the html-id-attribute-string of the element.
FormElement::printJavascriptEventHandler()
Compiles html-javascript-eventhandler-string of the element.
FormElement::printJavascriptValidationCode()
Grabs the compiled JS-validation-code for the element from its validator, if present and returns the code as a string.
FormElement::printMessages()
Returns a string of all aggregated error messages of the element.
FormElement::printName()
Compiles the html-name-string of the element.
FormElement::printNameArray()
Comiles the html-name-string of the element, if the element is part of a group of values.
FormElement::printTabIndex()
Calculates current ongoing tabindex of the form, refreshes it and returns the proper value for the element.
FormElement::printTitle()
Compiles the html-title-string of the element.
FormElement::printWrapperClasses()
Compiles a string of all classes for the tag-wrapper for the element's html-code.
FormElement::setCssClasses()
Sets the html-class-attribute for the element.
FormElement::setDisabled()
Set the element disabled.
FormElement::setId()
Sets the html-id for this element.
FormElement::setJavascriptEventHandler()
Sets a javascript-handler for the element.
FormElement::setLabel()
Inserts a label for the element.
FormElement::setMasterElement()
Sets the owning element for an element.
FormElement::setMasterForm()
Sets the owning form for an element and by doing so inserts the element into the logical structure of the form.
FormElement::setTitle()
Sets the html-title for this element.
FormElement::setUsable()
Set the element usables or disabled based on an expression.
FormElement::setValidator()
Sets a validator for a value-bearing element.
FormElement::validate()
Starts validation for the element and all subelements according to the rules laid out in the element's validator.

Class Details

[line 24]
Wraps a standard text-input.

This element is made for shorter, one-line text-inputs, rather than long texts, which should rather be treated with a textarea.




Tags:

author:  Sebastian Schlapkohl
version:  1.0


[ Top ]


Class Variables

$maxLength =

[line 44]

maximum amount of characters that can be inserted into the input, if the number is reached no further characters can be added



Tags:

access:  protected

Type:   uint


[ Top ]

$readonly =

[line 50]

defines if the input is in read-only-state or not



Tags:

access:  protected

Type:   Boolean


[ Top ]

$size =

[line 38]

amount of characters the input should hold horizontally, defines visual width as well



Tags:

access:  protected

Type:   uint


[ Top ]

$text =

[line 31]

the currently entered text (used for refill mostly, not synchronized to user input)



Tags:

access:  protected

Type:   String


[ Top ]



Class Methods


static method get [line 80]

static InputText get( String $name, [String $id = ''])

Factory method for InputText, returns new instance.

Factories are used to make instant chaining possible.




Tags:

return:  new InputText-instance
access:  public


Overridden in child classes as:

InputFile::get()
Factory method for InputFile, returns new instance.
InputPassword::get()
Factory method for InputPassword, returns new instance.
JsDateTime::get()
Factory method for JsDateTime, returns new instance.

Parameters:

String   $name   html-name for the element
String   $id   html-id for the element

[ Top ]

constructor __construct [line 59]

InputText __construct( String $name, [String $id = ''])

Hidden constructor.

Get new instances with "get()" instead.




Tags:

access:  protected


Overridden in child classes as:

InputFile::__construct()
Hidden constructor.
InputPassword::__construct()
Hidden constructor.
JsDateTime::__construct()
Hidden constructor.

Overrides FormElement::__construct() (General abstract, hidden formelement constructor.)

Parameters:

String   $name   html-name for the element
String   $id   html-id for the element

[ Top ]

method doRender [line 251]

String doRender( )

Compiles and returns the html-fragment for the element.



Tags:

return:  html-fragment for the element
access:  public


Overridden in child classes as:

InputFile::doRender()
Compiles and returns the html-fragment for the element.
InputPassword::doRender()
Compiles and returns the html-fragment for the element.
JsDateTime::doRender()
Compiles and returns the html-fragment for the element.

Overrides FormElement::doRender() (Returns the compiled html-code for the element.)

[ Top ]

method getValue [line 156]

String getValue( )

Returns the current value of the element.

In case of the standard text input this is always a simple, single string.




Tags:

return:  current value of element
access:  public


Overridden in child classes as:

InputFile::getValue()
Returns the current value of the element.

Overrides FormElement::getValue() (Returns the value of the element if there is any.)

[ Top ]

method printMaxLength [line 229]

String printMaxLength( )

Compiles and returns the html-maxlength-attribute for the element.



Tags:

return:  the html-maxlength-attribute of the element
access:  protected


[ Top ]

method printReadonly [line 240]

String printReadonly( )

Compiles and returns the html-readonly-attribute for the element.



Tags:

return:  the html-readonly-attribute of the element
access:  protected


[ Top ]

method printSize [line 218]

String printSize( )

Compiles and returns the html-size-attribute for the element.



Tags:

return:  the html-size-attribute of the element
access:  protected


[ Top ]

method refill [line 173]

InputText refill( [Array[String]|null $refiller = array()], [Boolean $condition = true])

Tries to refill the element-value from existing data.

This data can eiter be one of the method-arrays dependent on the method the surrounding form uses or a supplied array of name-value-pairs.




Tags:

return:  method owner
access:  public


Parameters:

Array[String]|null   $refiller   data to use as the refill source
Boolean   $condition   expression which defines if the refill will take place or not, to make it conditional so to speak

[ Top ]

method setMaxLength [line 127]

InputText setMaxLength( uint $maxLength)

Sets the maximum amount of characters that can be inserted into the input.

If the number is reached no further characters can be added.




Tags:

return:  method owner
access:  public


Parameters:

uint   $maxLength  

[ Top ]

method setReadonly [line 141]

InputText setReadonly( )

Sets that the element should be read-only.



Tags:

return:  method owner
access:  public


[ Top ]

method setSize [line 111]

InputText setSize( uint $size)

Sets the amount of characters the input should hold horizontally.

Defines visual width as well.




Tags:

return:  method owner
access:  public


Parameters:

uint   $size   amount of characters the element should show

[ Top ]

method setText [line 97]

InputText setText( String $text)

Sets the text to start with.

This text will be rendered into the html-code.




Tags:

return:  method owner
access:  public


Parameters:

String   $text   the text to insert into the element

[ Top ]

method validate [line 198]

Boolean validate( )

Starts the validation-process for the element.

Calculates the validity-status, based on the currently entered value, by applying the rules of a present validator. If there is none, the element is always valid.




Tags:

return:  element is currently valid yes/no
access:  public


Overrides FormElement::validate() (Starts validation for the element and all subelements according to the rules laid out in the element's validator.)

[ Top ]


Documentation generated on Fri, 18 Jul 2014 16:31:59 +0200 by phpDocumentor 1.4.3