Class ONEGEEK.forms.AbstractFormField

Direct Known Subclasses:

abstract class ONEGEEK.forms.AbstractFormField
Abstract Form Field object. Has the necessary functions to access, validate and clean a form elements' data This class should NOT be instantiated. Subclass and override these methods
Defined in ONEGEEK.forms

Variable Summary
protected String className
The class name used for this element, could be many per type
protected String contextMsg
Messages displayed to user when they are filling out field
protected String emptyMsg
Messages displayed to user when submitting an empty value for a required field
protected String errorMsg
Messages displayed to user on completion error
protected DOMElement field
DOM Element.
protected DOMElement fieldStatus
The status field span
protected ONEGEEK.forms.form form
The parent ONEGEEK.forms.form class
protected Boolean isRequired
Is this field required?
protected Boolean modified
Has the field been modified?
protected String msgSpan
The span to display field errors, messages, validation etc.
protected String state
Current state of the field.
protected DOMElement statusImg
The image for the status icon span
protected DOMElement statusLink
The link for the status icon
protected String successMsg
Messages displayed to user on successful completion

Function Summary
private void addPopupToggle (DOMElement statusLink, DOMElement msgSpan)
Get the function that hides/shows the message span
Applies field context information for form inputs.
Sets the fields' modified status to true.
Applies inline field validation for form inputs
public void clean()
Clean the field.
public void createFieldStatusIcon()
Get (and create) the fields status span (field status icon)
public void createRequiredSpan()
Create and insert the required span field if option enabled.
public DOMElement getDOMElement()
Get the actual DOM element for this field
public Boolean getModified()
Get the field's modified status
public DOMElement getMsgSpan()
Get the fields' associated message span
public void highlight()
Highlights the field according to GValidator options
public Boolean isRequiredField()
Is this a required field?
public void reset()
Reset the form value and state.
public void setClassName (String classname)
Set the class name that this element uses for validation purposes.
public void setForm (DOMElement form)
Set the parent form.
public Boolean setLabel()
Automatically sets the label for this element.
public void setLang (string lang)
Set the language translations for this.
public void setModified (Boolean modified)
Set the field's modified status
public void setOptions (Object options)
Override the default options for a class.
public void setState (String state)
Set the state of the field.
public void setup()
Add the Icons, spans and validation events
public void validate()
Validate the field.

Variable Details

variable protected String className

The class name used for this element, could be many per type

variable protected String contextMsg

Messages displayed to user when they are filling out field

variable protected String emptyMsg

Messages displayed to user when submitting an empty value for a required field

variable protected String errorMsg

Messages displayed to user on completion error

variable protected DOMElement field

DOM Element.

variable protected DOMElement fieldStatus

The status field span

variable protected ONEGEEK.forms.form form

The parent ONEGEEK.forms.form class

variable protected Boolean isRequired

Is this field required?

variable protected Boolean modified

Has the field been modified?

variable protected String msgSpan

The span to display field errors, messages, validation etc.

variable protected String state

Current state of the field.

variable protected DOMElement statusImg

The image for the status icon span

variable protected DOMElement statusLink

The link for the status icon

variable protected String successMsg

Messages displayed to user on successful completion

Function Details

function addPopupToggle

private void addPopupToggle(DOMElement statusLink, DOMElement msgSpan)
Get the function that hides/shows the message span
Parameters:
statusLink The link where the popup is
msgSpan The span to show/hide
Returns:
void

function applyContextInformation

private Function applyContextInformation(ONEGEEK.forms.AbstractFormField field)
Applies field context information for form inputs. Only show the first time
Parameters:
field The FormField object
Returns:
A function to display context information to the user

function applyFieldModification

private Function applyFieldModification(ONEGEEK.forms.AbstractFormField field)
Sets the fields' modified status to true.
Parameters:
field The field to set the updated flag
Returns:
The function used to update the fields modified status

function applyFieldValidation

private Function applyFieldValidation(ONEGEEK.forms.AbstractFormField field)
Applies inline field validation for form inputs
Parameters:
field The FormField object
Returns:
A function to validate the field

function clean

public void clean()
Clean the field. This provides no default implementation and should be overriden

function createFieldStatusIcon

public void createFieldStatusIcon()
Get (and create) the fields status span (field status icon)
Returns:
void

function createRequiredSpan

public void createRequiredSpan()
Create and insert the required span field if option enabled.
Returns:
void

function getDOMElement

public DOMElement getDOMElement()
Get the actual DOM element for this field
Returns:
The DOM Element for this field

function getModified

public Boolean getModified()
Get the field's modified status
Returns:
The modified status of the field

function getMsgSpan

public DOMElement getMsgSpan()
Get the fields' associated message span
Returns:
The DOMElement message span

function highlight

public void highlight()
Highlights the field according to GValidator options
Returns:
void

function isRequiredField

public Boolean isRequiredField()
Is this a required field?
Returns:
The requiredness of this field

function reset

public void reset()
Reset the form value and state.
Returns:
void

function setClassName

public void setClassName(String classname)
Set the class name that this element uses for validation purposes.
Parameters:
classname The class name that this element is using
Returns:
void

function setForm

public void setForm(DOMElement form)
Set the parent form. This is done on initialize
Parameters:
form The parent Form ONEGEEK.forms.form element
Returns:
void

function setLabel

public Boolean setLabel()
Automatically sets the label for this element.
Returns:
The result of the label find

function setLang

public void setLang(string lang)
Set the language translations for this.
Parameters:
lang The new language to use for the element i.e. "EN", "DE" etc.
Returns:
void

function setModified

public void setModified(Boolean modified)
Set the field's modified status
Parameters:
modified The new modified status of the field
Returns:
void

function setOptions

public void setOptions(Object options)
Override the default options for a class. Used by translation service and plugins.
Parameters:
options The key/value pairs of options to override
Returns:
void

function setState

public void setState(String state)
Set the state of the field. This will show the relevant icons and error messages for the field
Parameters:
state The fields' state. Can be one of: ONEGEEK.forms.FIELD_STATUS_(EMPTY|OK|INFO|ERROR|RESET)
Returns:
void

function setup

public void setup()
Add the Icons, spans and validation events
Returns:
void

function validate

public void validate()
Validate the field. Defaults to returning true if there is a value for the field
Returns:
true if there is a value, false if not