com.lokorin.dfcrafters.lib
[ class tree: com.lokorin.dfcrafters.lib ] [ index: com.lokorin.dfcrafters.lib ] [ all elements ]

Class: Field

Source Location: /_includes/lib_forms.php

Class Overview


Describes a field in a form.


Author(s):

  • Andreas Launila

Variables

Methods


Child classes:

Hidden
Describes a hidden field.
ReadOnly
Describes a field that is read only. I.e. just prints the contents of it, not really a field, but it's useful at times.
Checkbox
Describes a checkbox.
Button
Describes a button.
SubmitButton
Describes a submit button.
ResetButton
Describes a reset button.
SizedField
Describes a field that can be sized.
Select
Describes a select field.
DateField
Describes a field (or rather group of fields) that allows the user to select a specific date by selecting year, month and day.

Class Details

[line 46]
Describes a field in a form.



Tags:

abstract:  
author:  Andreas Launila


[ Top ]


Class Variables

$attributes =

[line 72]

Any additional attributes where the key is the attribute name and the value is the the attribute value.



Tags:

access:  private

Type:   array


[ Top ]

$hasUserValue =

[line 77]

True if the current value was entered by a user, false otherwise.



Tags:

access:  private

Type:   boolean


[ Top ]

$id =

[line 66]

The unique identifier for the field.



Tags:

access:  private

Type:   integer


[ Top ]

$name =

[line 51]

The name of the field.



Tags:

access:  private

Type:   string


[ Top ]

$required =

[line 56]

If the field has to be entered to be valid.



Tags:

access:  private

Type:   boolean


[ Top ]

$value =

[line 61]

The value of the field.



Tags:

access:  private

Type:   string


[ Top ]



Class Methods


constructor __construct [line 85]

Field __construct( string $name, [boolean $required = false])

Constructor for Field.



Tags:

access:  public


Overridden in child classes as:

Hidden::__construct()
Constructor for Hidden.
ReadOnly::__construct()
Constructor for ReadOnly.
Checkbox::__construct()
Constructor for Checkbox.
Button::__construct()
Constructor for Button.
SubmitButton::__construct()
Constructor for SubmitButton.
ResetButton::__construct()
Constructor for ResetButton.
SizedField::__construct()
Constructor for SizedField.
TextField::__construct()
Constructor for TextField.
PasswordField::__construct()
Constructor for PasswordField.
TextArea::__construct()
Constructor for TextArea.
Browse::__construct()
Constructor for Browse.
Select::__construct()
Constructor for Select.
DateField::__construct()
Constructor for DateField.
TimeField::__construct()
Constructor for TimeField.

Parameters:

string   $name   The name of the field.
boolean   $required   True if the field has to contain something to be valid, false otherwise. False by default.

[ Top ]

method formatAddition [line 216]

mixed formatAddition( $additionToFormat $additionToFormat)

Formats any additional data that should be appended to the field. Any '%id' entities in the formatted string are replaced with the field's id. Any '%name' entities in the formatted string are replaced with the field's name.



Tags:

return:  The formatted addition, the function may return it intact, modified or fully removed if it wished. The only guarantee is that there will be no '%id' or '%name' entities in the result.
access:  public


Overridden in child classes as:

DateField::formatAddition()
No additions are allowed.

Parameters:

$additionToFormat   $additionToFormat   The addition that should be formatted.

[ Top ]

method getAsHtml [line 131]

string getAsHtml( )

Returns the (X)HTML representation of the field. This function should be concidered as an abstract function, any subclasses should override this.



Tags:

return:  An field in HTML.
abstract:  
access:  public


Overridden in child classes as:

Hidden::getAsHtml()
ReadOnly::getAsHtml()
Checkbox::getAsHtml()
Button::getAsHtml()
SubmitButton::getAsHtml()
ResetButton::getAsHtml()
TextField::getAsHtml()
PasswordField::getAsHtml()
TextArea::getAsHtml()
Browse::getAsHtml()
Select::getAsHtml()

[ Top ]

method getAttributes [line 154]

string getAttributes( )

Gets the (X)HTML information containing all base information.



Tags:

return:  A bunch of attributes.
access:  protected


Overridden in child classes as:

SizedField::getAttributes()

[ Top ]

method getError [line 172]

void getError( )



Tags:

access:  public
see:  Validatable.getError()


[ Top ]

method getId [line 137]

string getId( )

Gets the field's id.



Tags:

return:  An field id.
access:  public


[ Top ]

method getName [line 103]

string getName( )

Gets the name of the field.



Tags:

return:  A field name.
access:  public


[ Top ]

method getValue [line 111]

string getValue( )

Gets the value of the field.



Tags:

return:  A field value.
access:  public


Overridden in child classes as:

DateField::getValue()
TimeField::getValue()

[ Top ]

method hasUserValue [line 202]

boolean hasUserValue( )

Checks if the field has a non empty value that has been supplied by a user.



Tags:

return:  True if the field has a non empty value supplied by the user, false otherwise.
access:  public


Overridden in child classes as:

Hidden::hasUserValue()
SubmitButton::hasUserValue()
DateField::hasUserValue()
TimeField::hasUserValue()

[ Top ]

method hasValue [line 192]

boolean hasValue( )

Checks if the field has a non empty value.



Tags:

return:  True if the field has a non empty value, false otherwise.
access:  public


Overridden in child classes as:

DateField::hasValue()

[ Top ]

method isValid [line 165]

void isValid( )



Tags:

access:  public
see:  Validatable.isValid()


[ Top ]

method setAttribute [line 183]

void setAttribute( string $name, string $value)

Sets one of the firleds attributes. If the attribute does not exist then it is created. The attributes 'id', 'name' and 'value' can not be modified throught this function.



Tags:

access:  public


Parameters:

string   $name   The name of the attribute.
string   $value   The value that the attribute should have.

[ Top ]

method setId [line 145]

void setId( string $newId)

Sets the field's id.



Tags:

access:  public


Parameters:

string   $newId   The id to be used by the field.

[ Top ]

method setValue [line 119]

void setValue( mixed $newValue)

Sets the value of the field.



Tags:

access:  public


Overridden in child classes as:

DateField::setValue()
TimeField::setValue()

Parameters:

mixed   $newValue   The new value for the field.

[ Top ]


Documentation generated on Tue, 10 Jan 2006 17:06:31 +0100 by phpDocumentor 1.3.0RC4