static method get [line 82]
Factory method for FormValidator, returns new instance.
Factories are used to make instant chaining possible.
Tags:
method activateJavascriptValidation [line 2191]
FormValidator activateJavascriptValidation(
[String|null
$selector = null], [String|null
$errorSelector = null])
|
|
Prepares the validator for output of JS-valiation-code later on.
Tags:
Parameters:
method hasRule [line 2142]
void hasRule(
$ruleName, [
$ruleValue = null])
|
|
Tags:
Parameters:
method printJavascriptValidationCode [line 2254]
String printJavascriptValidationCode(
[Boolean
$prepareMessages = true])
|
|
Compiles and returns the JS-validation-code for this validator, to be printed beneath the validated form elements in the source later on. This code contains a sequence of single tests, that will be executed on every update of the connected elements, which validate the value(s) one by one.
At the moment, there is no smart procedure to reuse code parts in several validations. Each fragment is specifically and autonomously constructed for each validator.
Tags:
Parameters:
method printMessageQueue [line 2223]
String printMessageQueue(
[Boolean
$onlyCustomMessages = false])
|
|
Return all aggregated error messages of the validator.
This method will only return something wortwhile after process() has been called, since before that there are no messages queued.
Tags:
Parameters:
method process [line 2166]
Starts the validation if the given values accourding to all set rules of the validator.
Normally called automatically by the widget the values originate from.
Tags:
method setAutoErrorMessagesAsCustom [line 130]
Tells the validator to treat standard messages as custom in the context of this validator.
This method has the purpose to use standard messages selectively in a form where standard messages are disabled by default.
Tags:
method setCharacterClass [line 584]
Adds a rule to the validator's ruleset - The widget's value must only consist of characters defined in a given regex-character-class.
a-zA-Z0-9äüöÄÜÖß for example
Tags:
Parameters:
method setCreditcard [line 569]
Adds a rule to the validator's ruleset - The widget's value has have the form of a valid creditcard-number.
(1)234-1234-1234-1234
Tags:
method setCustomCase [line 236]
Adds a rule to the validator's ruleset - Includes a predefined validation-result into the ruleset.
The result may have two characteristics: Eiter it's a boolean value, simply telling the validator if the test has succeeded or failed. Or it's a string, with an empty string being a successful test and a non-empty string being a failed test, where the string is the error message to display. This is not a custom message, but rather an override for the standard message, which is rather nondescript for custom cases.
You can also provide an Array, where the first element is the PHP-expression, while the second element must be valid JS-code to return the validation result from. The JS-validation-code has to set the var res (don't redeclare the var) to the result of the validation.
You can even set this handler up for async validation by not setting res, but instead calling customCaseAsyncFinalize(res) at the end of the async request. Here two examples for special-JS-code:
sequential: ->setCustomCase(array(true, 'res = $('body .class_'+$(this).val()).length > 0;'))
async: ->setCustomCase(array(true, '$.getJSON('/service:validation/something', {a:'b'}, function(data){ customCaseAsyncFinalize(data.res) });'))
Tags:
Parameters:
method setDataName [line 160]
Tells the validator the name of the element's data in the submit-resultset.
This is normally identical to the html-name-attribute's value of the rendered element.
Tags:
Parameters:
method setDate [line 412]
Adds a rule to the validator's ruleset - The widget's value must be a standard american date.
(d)d/(m)m/yyyy
Tags:
method setDateDE [line 490]
Adds a rule to the validator's ruleset - The widget's value must be a standard german date.
(d)d.(m)m.yyyy
Tags:
method setDateISO [line 451]
Adds a rule to the validator's ruleset - The widget's value must be a standard iso-date.
yyyy-mm-dd
Tags:
method setDateTime [line 438]
Adds a rule to the validator's ruleset - The widget's value must be standard american datetime.
Either dd/mm/yyyy + (h)h:mm(:ss)am|pm
Tags:
method setDateTimeDE [line 516]
Adds a rule to the validator's ruleset - The widget's value must be a standard german datetime.
(d)d.(m)m.yyyy hh:mm:ss(h)
Tags:
method setDateTimeISO [line 477]
Adds a rule to the validator's ruleset - The widget's value must be standard iso-datetime.
yyyy-mm-dd(T| )hh:mm:ss
Tags:
method setDigits [line 556]
Adds a rule to the validator's ruleset - The number-representation of the widget's value must be only digits without any other characters.
1234567890
Tags:
method setEmail [line 384]
Adds a rule to the validator's ruleset - The widget's value must be a valid eMail-address.
This is no run-of-the-mill check, but quite elaborate.
Tags:
method setErrorMessage [line 116]
Sets a custom error message for the validator, overwriting all standard messages from the dictionaries.
Use this to further describe special error cases, to aid your users.
Tags:
Parameters:
method setFieldName [line 147]
Tells the validator the name of the element in validates.
In most cases this is the value of the widget's label. This information is necessary for standard-message-display and normally provided automatically when inserting a validator into an element.
Tags:
Parameters:
method setMax [line 355]
Adds a rule to the validator's ruleset - The number-representation of the widget's value can only have a maximum numeric value.
For multiple values this rule will check each value individually.
Tags:
Parameters:
method setMaxLength [line 309]
Adds a rule to the validator's ruleset - The string-representation of the widget's value may only have a certain length.
For multiple values this method uses the amount of values.
Tags:
Parameters:
method setMessageLanguage [line 101]
Sets the language for all validation-error-messages take from message dictionaries.
The available languages and their names are defined by the dictionaries present in /messages.
Tags:
Parameters:
method setMin [line 340]
Adds a rule to the validator's ruleset - The number-representation of the widget's value must have a minimum numeric value.
For multiple values this rule will check each value individually.
Tags:
Parameters:
method setMinLength [line 294]
Adds a rule to the validator's ruleset - The string-representation of the widget's value needs to have a certain length.
For multiple values this method uses the amount of values.
Tags:
Parameters:
method setNotEmpty [line 265]
Adds a rule to the validator's ruleset - The widget needs to have a non-empty value.
Either this means that the value can't be an empty string or one consisting of whitespace or that the amount of values mustn't be 0.
Tags:
Parameters:
method setNumber [line 529]
Adds a rule to the validator's ruleset - The widget's value must be a standard english decimal number.
123(.456)
Tags:
method setNumberDE [line 542]
Adds a rule to the validator's ruleset - The widget's value must be a standard german decimal number.
123(,456)
Tags:
method setOptional [line 279]
Adds a rule to the validator's ruleset - The widget's value becomes optional, either its not set at all, or it get validated by all other present rules.
Tags:
Parameters:
method setRange [line 371]
Adds a rule to the validator's ruleset - The number-representation of the widget's value must have a minimum and can only be of a maximum numeric value.
In general this is a shortcut for setMin()+setMax(). For multiple values this rule will check each value individually.
Tags:
Parameters:
method setRangeLength [line 325]
Adds a rule to the validator's ruleset - The string-representation of the widget's value must have a minimum length and must not exceed a maximum length.
In general this is a shortcut for setMinLength()+setMaxLength(). For multiple values this method uses the amount of values.
Tags:
Parameters:
method setRequired [line 250]
Adds a rule to the validator's ruleset - The widget needs to have a value.
Either this means that the value can't be an empty string or that the amount of values mustn't be 0.
Tags:
method setTime [line 425]
Adds a rule to the validator's ruleset - The widget's value must be standard american time.
(h)h:mm(:ss)am|pm
Tags:
method setTimeDE [line 503]
Adds a rule to the validator's ruleset - The widget's value must be a standard german time.
hh:mm:ss(h)
Tags:
method setTimeISO [line 464]
Adds a rule to the validator's ruleset - The widget's value must be standard iso-time.
hh:mm:ss
Tags:
method setUrl [line 399]
Adds a rule to the validator's ruleset - The widget's value must be a valid url.
This is no run-of-the-mill check, but quite elaborate. Url has to look something like this. [http(s)/ftp][subdomain/domain][domain/tld]([tld])([port])([query])([anchor])
Tags:
method setUtf8Safety [line 204]
Tells the validator to treat all validated values as utf-8-encoded or vice versa.
Tags:
Parameters:
method setValue [line 177]
Set the value the validator should validate.
Used for widgets with single values.
Tags:
Parameters:
method setValues [line 191]
Set the values the validator should validate.
Used for widgets with multiple values.
Tags:
Parameters: