SForm_Rule_Boolean __construct(
string
$message, array
$elements, string
$freeFormBool
)
|
|
Create a free form boolean rule
The first arg is the messsage that will be returned when an error ocours.
The second arg are the elements who's values will be fed into the boolean statement.
Last argument is a boolean string, with vars like http://www.php.net/sprintf would accept. The placeholders in the string should be '%s' so we can insert the required text into it. The boolean string should evaluate to true iff there is an error.
Parameters:
|
string |
$message: |
Error message |
|
array |
$elements: |
The elements used by the statement |
|
string |
$freeFormBool: |
Boolean statement |
Redefinition of:
- SForm_Rule::__construct()
- Construct a rule with one element and one error message
Does the statement evaluate to true?
Values are found for each of the input elements, php code is created using those values, and the whole thing is fed through eval() to produce a boolean value.
API Tags:
| Return: | Evaluation of the boolean statement |
| Access: | public |
Redefinition of:
- SForm_Rule::isError()
- Returns true if this element(s) fail validation
Generates JS that will execute the boolean statement
The code to locate the value of each element is created with the necessary local variables and the local variables are parsed into the boolean string. The strings are then inserted in the appropriate points in JS to throw an error if the boolean statement evaluated as true.
API Tags:
| Return: | JavaScript |
| Access: | public |
Redefinition of:
- SForm_Rule::toJavaScript()
- Get the JavaScript that should be run onsubmit