Search:

# CWIS Developers Documentation

- Main Page
- Classes
- Files

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# FormField Class Reference

Generator for HTML form fields. More...

Inheritance diagram for FormField:

[legend]
List of all members.

## Setup/Initialization
| FormField ($Name, $IsRequired, $Label, $ValidFunc, $ValidMsgs)
| Object Constructor.
## Accessors
| Name ($NewVal=NULL)
| Get or set Name (internal name for id=).
| IsRequired ($NewVal=NULL)
| Get or set IsRequired.
| Label ($NewVal=NULL)
| Get or set the Label (display name in generated HTML).
| Value ($NewVal=NULL)
| Get or set the field's value.
| IsPassword ()
| Determine if this field is a password fild.
## Display
| PrintField ($DisplayErrorIndicator=FALSE)
| Print the label and generate input tags for this object.
| PrintLabel ($DisplayErrorIndicator=FALSE)
| Print the label for this field without generating the input tags.
## Error Checking
| IsInvalidValue ($Value)
| Check the validity of the field's value.
| GetInvalidValueMessage ($ErrorCode)
| Map an error code from IsInvalidValue to an error message.
## Protected Attributes
| $MyName
| $MyIsRequired
| $MyLabel
| $MyValue
| $MyValidFunc
| $MyValidMsgs

## Detailed Description

Generator for HTML form fields.

Definition at line 6 of file FormField.php.

## Member Function Documentation

FormField::FormField | ( | $ | Name,
|  | $ | IsRequired,
|  | $ | Label,
|  | $ | ValidFunc,
|  | $ | ValidMsgs |
| ) |  |  |

Object Constructor.

Parameters:

  | Name | Internal name for this field, used in the HTML for id=
  | IsRequired |
  | Label | Display label for this field, shown to the user
  | ValidFunc | A function to check the validity of input to this field The function should return 0 for valid input
  | ValidMsgs | An array of error messages, corresponding to the error codes returned by ValidFunc

Definition at line 23 of file FormField.php.

Referenced by CheckboxFormField::CheckboxFormField(), OptionFormField::OptionFormField(), and TextFormField::TextFormField().

Here is the caller graph for this function:

FormField::GetInvalidValueMessage | ( | $ | ErrorCode | ) |

Map an error code from IsInvalidValue to an error message.

Parameters:

  | ErrorCode | the error code assumed to come from IsInvalidValue()

Returns:
  a text string corresponding to the given error code

Definition at line 152 of file FormField.php.

FormField::IsInvalidValue | ( | $ | Value | ) |

Check the validity of the field's value.

Returns:
  (int) non-zero for invalid input

Definition at line 120 of file FormField.php.

FormField::IsPassword | ( |  | ) |

Determine if this field is a password fild.

Returns:
  TRUE for password fields, FALSE otherwise

Definition at line 80 of file FormField.php.

FormField::IsRequired | ( | $ | NewVal = `NULL` | ) |

Get or set IsRequired.

Parameters:

  | NewVal | (OPTIONAL)

Returns:
  current value of IsRequired

Definition at line 61 of file FormField.php.

FormField::Label | ( | $ | NewVal = `NULL` | ) |

Get or set the Label (display name in generated HTML).

Parameters:

  | NewVal | (OPTIONAL)

Returns:
  current label

Definition at line 67 of file FormField.php.

FormField::Name | ( | $ | NewVal = `NULL` | ) |

Get or set Name (internal name for id=).

Parameters:

  | NewVal | New value for the object's name (OPTIONAL)

Returns:
  The objects current name

Definition at line 52 of file FormField.php.

FormField::PrintField | ( | $ | DisplayErrorIndicator = `FALSE` | ) |

Print the label and generate input tags for this object.

Parameters:

  | DisplayErrorIndicator | TRUE to display errors with this field (OPTIONAL, default=FALSE)

Reimplemented in CheckboxFormField.

Definition at line 92 of file FormField.php.

References PrintLabel().

FormField::PrintLabel | ( | $ | DisplayErrorIndicator = `FALSE` | ) |

Print the label for this field without generating the input tags.

Parameters:

  | DisplayErrorIndicator | TRUE to display errors with this field (OPTIONAL, default=FALSE)

Definition at line 103 of file FormField.php.

Referenced by PrintField(), and CheckboxFormField::PrintField().

Here is the caller graph for this function:

FormField::Value | ( | $ | NewVal = `NULL` | ) |

Get or set the field's value.

Parameters:

  | NewVal | (OPTIONAL)

Returns:
  current form value

Definition at line 74 of file FormField.php.

Referenced by OptionFormField::PrintInput().

Here is the caller graph for this function:

## Member Data Documentation

FormField::$MyIsRequired`[protected]`

Definition at line 176 of file FormField.php.

FormField::$MyLabel`[protected]`

Definition at line 177 of file FormField.php.

FormField::$MyName`[protected]`

Definition at line 175 of file FormField.php.

FormField::$MyValidFunc`[protected]`

Definition at line 179 of file FormField.php.

FormField::$MyValidMsgs`[protected]`

Definition at line 180 of file FormField.php.

FormField::$MyValue`[protected]`

Definition at line 178 of file FormField.php.

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

- FormField.php