|
CWIS Developer Documentation
|
Helps print and validate form fields, and their errors, associated with a form. More...
Public Member Functions | |
| FormTool ($FormFields, $AdditionalErrorMessages=NULL) | |
| Object constructor. More... | |
| ValueForField ($FieldName, $NewValue=NULL) | |
| Get and set the value for a form field. More... | |
| AllRequiredVarsAreSet () | |
| Determine whether all of the required form field values are set in the POST variables. More... | |
| GetValsAsUrlParams ($IncludePasswords=FALSE) | |
| Return the URL parameter string with form field values that are set in the POST variables. More... | |
| SetFieldValuesFromUrlParams () | |
| Set the values for the form fields from the URL parameters when available. More... | |
| IncomingFieldValuesHaveErrors () | |
| Check the incoming form values for each field and report whether errors were found. More... | |
| GetErrorCodesAsUrlParams () | |
| Return the URL parameter string with error codes for any form value errors. More... | |
| SetAdditionalErrorFields ($FieldNames) | |
| Save additional fields marked as having errors. More... | |
| SetAdditionalErrorCodes ($Codes) | |
| Save additional error codes if not already present. More... | |
| GetUrlWithValuesAndErrorCodes ($BaseUrl, $IncludePasswords=FALSE) | |
| Convenience method that adds value and error codes to the URL. More... | |
| GetErrorMessages ($EliminateDuplicateMessages=TRUE) | |
| Get the list of error messages based on the error codes from the URL via $_GET. More... | |
| PrintField ($FieldName) | |
| Print the label and input for given form field. More... | |
| PrintLabelForField ($FieldName) | |
| Print the label element for the given field. More... | |
| PrintInputForField ($FieldName) | |
| Print the input element for the given field. More... | |
| ErrorCodesAvailable () | |
| Determine if there are any error codes available from the form. More... | |
| CheckFieldValue ($FieldName) | |
| Extracts a form variable for the specified field and validates it via the form objects. More... | |
Static Public Member Functions | |
| static | GetArrayOfUsStates () |
| Get an array of US state names with their two-letter abbreviations as the index. More... | |
Public Attributes | |
| $Fields | |
| $ErrorColor | |
| $AdditionalErrorCodes | |
| $AdditionalErrorFields | |
| $AdditionalErrorMessages | |
Helps print and validate form fields, and their errors, associated with a form.
Definition at line 14 of file FormTool.php.
| FormTool::AllRequiredVarsAreSet | ( | ) |
Determine whether all of the required form field values are set in the POST variables.
Definition at line 100 of file FormTool.php.
| FormTool::CheckFieldValue | ( | $FieldName | ) |
Extracts a form variable for the specified field and validates it via the form objects.
| string | $FieldName | Form field name. |
Definition at line 510 of file FormTool.php.
Referenced by GetErrorCodesAsUrlParams(), PrintField(), PrintInputForField(), and PrintLabelForField().

| FormTool::ErrorCodesAvailable | ( | ) |
Determine if there are any error codes available from the form.
Definition at line 426 of file FormTool.php.
Referenced by PrintField(), PrintInputForField(), and PrintLabelForField().

| FormTool::FormTool | ( | $FormFields, | |
$AdditionalErrorMessages = NULL |
|||
| ) |
Object constructor.
| mixed | $FormFields | Array of form field objects or the path to a file that loads and returns form field objects via $FormFields. |
| array | $AdditionalErrorMessages | Additional error messages to add, if any. This parameter is optional. |
Definition at line 25 of file FormTool.php.
References $AdditionalErrorMessages.
|
static |
Get an array of US state names with their two-letter abbreviations as the index.
Definition at line 437 of file FormTool.php.
| FormTool::GetErrorCodesAsUrlParams | ( | ) |
Return the URL parameter string with error codes for any form value errors.
The URL parameter string does not include a leading separator (? or &).
Definition at line 187 of file FormTool.php.
References CheckFieldValue().
Referenced by GetUrlWithValuesAndErrorCodes(), and IncomingFieldValuesHaveErrors().

| FormTool::GetErrorMessages | ( | $EliminateDuplicateMessages = TRUE | ) |
Get the list of error messages based on the error codes from the URL via $_GET.
| bool | $EliminateDuplicateMessages | TRUE to remove error messages that are exactly the same. |
Definition at line 318 of file FormTool.php.
| FormTool::GetUrlWithValuesAndErrorCodes | ( | $BaseUrl, | |
$IncludePasswords = FALSE |
|||
| ) |
Convenience method that adds value and error codes to the URL.
| string | $BaseUrl | Base URL to which to add the value and error codes. |
| bool | $IncludePasswords | TRUE to include password fields in the URL parameters. |
Definition at line 300 of file FormTool.php.
References GetErrorCodesAsUrlParams(), and GetValsAsUrlParams().
| FormTool::GetValsAsUrlParams | ( | $IncludePasswords = FALSE | ) |
Return the URL parameter string with form field values that are set in the POST variables.
The URL parameter string does not include a leading separator (? or &).
| bool | $IncludePasswords | TRUE to include password fields in the URL parameters. |
Definition at line 128 of file FormTool.php.
Referenced by GetUrlWithValuesAndErrorCodes().

| FormTool::IncomingFieldValuesHaveErrors | ( | ) |
Check the incoming form values for each field and report whether errors were found.
Definition at line 174 of file FormTool.php.
References GetErrorCodesAsUrlParams().
| FormTool::PrintField | ( | $FieldName | ) |
Print the label and input for given form field.
| string | $FieldName | Form field name. |
Definition at line 393 of file FormTool.php.
References CheckFieldValue(), and ErrorCodesAvailable().
| FormTool::PrintInputForField | ( | $FieldName | ) |
Print the input element for the given field.
| string | $FieldName | Form field name. |
Definition at line 415 of file FormTool.php.
References CheckFieldValue(), and ErrorCodesAvailable().
| FormTool::PrintLabelForField | ( | $FieldName | ) |
Print the label element for the given field.
| string | $FieldName | Form field name. |
Definition at line 404 of file FormTool.php.
References CheckFieldValue(), and ErrorCodesAvailable().
| FormTool::SetAdditionalErrorCodes | ( | $Codes | ) |
Save additional error codes if not already present.
| array | $Codes | Additional error codes to save. |
Definition at line 274 of file FormTool.php.
| FormTool::SetAdditionalErrorFields | ( | $FieldNames | ) |
Save additional fields marked as having errors.
| array | $FieldNames | Field names to mark as having errors. |
Definition at line 252 of file FormTool.php.
| FormTool::SetFieldValuesFromUrlParams | ( | ) |
Set the values for the form fields from the URL parameters when available.
Definition at line 155 of file FormTool.php.
| FormTool::ValueForField | ( | $FieldName, | |
$NewValue = NULL |
|||
| ) |
Get and set the value for a form field.
| string | $FieldName | Form field name. |
| mixed | $NewValue | New value to set for the form field. This parameter is optional. |
Definition at line 89 of file FormTool.php.
| FormTool::$AdditionalErrorCodes |
Definition at line 500 of file FormTool.php.
| FormTool::$AdditionalErrorFields |
Definition at line 501 of file FormTool.php.
| FormTool::$AdditionalErrorMessages |
Definition at line 502 of file FormTool.php.
Referenced by FormTool().
| FormTool::$ErrorColor |
Definition at line 499 of file FormTool.php.
| FormTool::$Fields |
Definition at line 498 of file FormTool.php.