ZMObject
└─ZMRule
└─ZMWrapperRule
public class ZMWrapperRule
extends ZMRule
| Method Summary | |
|---|---|
| void | __construct(string name, string msg, mixed function, string defaultMsg) Create new rule. |
| 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 | |
|---|---|
| __construct, getDefaultMsg, getErrorMsg, getJSName, getMsg, getName, setDefaultMsg, setMsg, setName, toJSString, validate | |
| Methods inherited from org.zenmagick.core\ZMObject | |
|---|---|
| __construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton | |
public void __construct(string name, string msg, mixed function, string defaultMsg)
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.