|
PHP2Go Javascript Framework | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--FormValidator
Defined in validator.js
| Field Summary | |
Array |
emptyLabels
Set of empty mandatory fields |
Object |
errorDisplayOptions
Error summary properties |
Object |
frm
Form reference |
Array |
messages
Set of error messages |
Array |
validators
Set of validators |
<static> Number |
LIST_BULLET
Unordered lists must be used to display the summary items |
<static> Number |
LIST_FLOW
Summary items must be displayed inside an HTML table |
<static> Number |
MODE_ALERT
Errors summary must be reported using an alert box |
<static> Number |
MODE_DHTML
Errors summary must be displayed inside some page's node (inline) |
| Constructor Summary | |
FormValidator
(<Object> frm)
The FormValidator class executes validation routines on fields of a given form. |
|
| Method Summary | |
void
|
add(<String> field, <Function> validator, <Object> args)
Adds a new validator in the validation chain. |
String
|
buildErrors()
Builds a string buffer containing the error message(s) |
void
|
clearErrors()
Clears the target node used to display the error message(s) |
Boolean
|
onAfterValidate(<FormValidator> self)
This abstract method can be overriden to define extra validation routines. |
void
|
onBeforeValidate(<FormValidator> self)
Used by the forms API to apply transformations in some fields values (upper, lower, trim, capitalize) before submission |
void
|
run(<Event> e)
This method runs all the registered validators, collecting the produced error messages. |
void
|
setErrorDisplayOptions(<Number> mode, <Object> target, <Boolean> showAll, <Number> list, <String> header)
Configures how validation error(s) must be displayed |
void
|
setup()
Register an onsubmit event listener in the form. |
void
|
showErrors()
Shows the error message(s) using an alert box (MODE_ALERT) or a given target node (MODE_DHTML) |
| Field Detail |
Array emptyLabels
Object errorDisplayOptions
Object frm
Array messages
Array validators
<static> Number LIST_BULLET
<static> Number LIST_FLOW
<static> Number MODE_ALERT
<static> Number MODE_DHTML
| Constructor Detail |
FormValidator(<Object> frm)
frm - Form reference or id
| Method Detail |
void add(<String> field, <Function> validator, <Object> args)
field - Field name
validator - Validator
args - Hash of validator arguments
String buildErrors()
void clearErrors()
Boolean onAfterValidate(<FormValidator> self)
self - FormValidator instance
void onBeforeValidate(<FormValidator> self)
self - FormValidator instance
void run(<Event> e)
e - Event reference
void setErrorDisplayOptions(<Number> mode, <Object> target, <Boolean> showAll, <Number> list, <String> header)
mode - Display mode (MODE_ALERT or MODE_DHTML)
target - Container node (id or reference)
showAll - Show all errors or just the first one
list - List mode (LIST_FLOW or LIST_BULLET)
header - Summary header
void setup()
void showErrors()
|
PHP2Go Javascript Framework | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||