ZMObject
└─ZMRule
└─ZMWrapperRule
public class ZMWrapperRule
extends ZMRule
| Constructor Summary | |
|---|---|
ZMWrapperRule(string name, string msg, mixed function) Create new rule. |
|
| Method Summary | |
|---|---|
| void | setFunction(string function) Set the validation function. |
| void | setJavaScript(string javascript) Set the JavaScript validation code. |
| string | Create JS validation call. |
| boolean | validate(ZMRequest request, array data) Validate the given request data. |
| Methods inherited from org.zenmagick.mvc.validation.ZMRule | |
|---|---|
| getDefaultMsg, getErrorMsg, getJSName, getMsg, getName, setDefaultMsg, setMsg, setName, toJSString, validate | |
| Methods inherited from org.zenmagick.core.ZMObject | |
|---|---|
| attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton | |
public ZMWrapperRule(string name, string msg, mixed function)
Create new rule.
null.null.null.public void setFunction(string function)
Set the validation function.
The function must implement the same siganture as ZMRule::validate($request, $data).
public void setJavaScript(string javascript)
Set the JavaScript validation code.
public string toJSString()
Create JS validation call.
public boolean validate(ZMRequest request, array data)
Validate the given request data.
true if the value for $name is valid, false if not.
Empty validation rules that can be used to wrap custom logic.