ZMObject
└─ZMValidator
public class ZMValidator
extends ZMObject
| Fields inherited from org.zenmagick.core.ZMObject | |
|---|---|
| properties_ | |
| Constructor Summary | |
|---|---|
Create new instance. |
|
| Method Summary | |
|---|---|
| void | addAlias(string id, string alias) Add an alias to share rules between different forms. |
| void | addRule(string id, array rule, boolean override) Add a new rule for the given rule set id. |
| void | addRules(string id, array rules, boolean override) Add a list of new rules for the given rule set id. |
| array | If a validation was not successful, corresponding error messages will be available here. |
| ZMRuleSet | getRuleSet(string id, boolean compile) Get a ZMRuleSet for the given id/name. |
| boolean | hasRuleSet(string id) Check if a ZMRuleSet exists for the given id. |
| static void | instance() Get instance. |
| protected string | resolveAlias(string id) Resolve alias. |
| string | toJSString(string id, boolean echo) Create JS validation rules for the given rule set. |
| boolean | validate(ZMRequest request, mixed data, string id) Validate the given request/object using the named (id) rule set. |
| Methods inherited from org.zenmagick.core.ZMObject | |
|---|---|
| attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton | |
public ZMValidator()
Create new instance.
public void addAlias(string id, string alias)
Add an alias to share rules between different forms.
Adding / modifying an alias is not permitted and the result not defined.
public void addRule(string id, array rule, boolean override)
Add a new rule for the given rule set id.
false (add).public void addRules(string id, array rules, boolean override)
Add a list of new rules for the given rule set id.
false (add).public array getMessages()
If a validation was not successful, corresponding error messages will be available here.
public ZMRuleSet getRuleSet(string id, boolean compile)
Get a ZMRuleSet for the given id/name.
true, evaluate the rule data (creating objects, etc); default is false.ZMRuleSet instance, array or null.public boolean hasRuleSet(string id)
Check if a ZMRuleSet exists for the given id.
true if a ZMRuleSet exists, false if not.public static void instance()
Get instance.
protected string resolveAlias(string id)
Resolve alias.
public string toJSString(string id, boolean echo)
Create JS validation rules for the given rule set.
ZMRuleSet name).true, the JavaScript will be echo'ed as well as returned.public boolean validate(ZMRequest request, mixed data, string id)
Validate the given request/object using the named (id) rule set.
If the request parameter is an object, it will be added to the
internally used data map using the magic key __obj.
true if the validation was successful, false if not.
A validator framework.