ZenMagick 0.9.10


org.zenmagick.mvc.validation.rules\ZMWrapperRule
mvc\validation\rules\ZMWrapperRule.php at line 30

Class ZMWrapperRule

ZMObject
└─ZMRule
└─ZMWrapperRule

public class ZMWrapperRule
extends ZMRule

Empty validation rules that can be used to wrap custom logic.

Author:
DerManoMann

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

toJSString()

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

Method Detail

mvc\validation\rules\ZMWrapperRule.php at line 42

__construct

public void __construct(string name, string msg, mixed function, string defaultMsg)

Create new rule.

Parameters:
name - The field name; default is null.
msg - Optional message; default is null.
function - The function name or array; default is null.

mvc\validation\rules\ZMWrapperRule.php at line 64

setFunction

public void setFunction(string function)

Set the validation function.

The function must implement the same siganture as ZMRule::validate($request, $data).

Parameters:
function - The function name.

mvc\validation\rules\ZMWrapperRule.php at line 73

setJavaScript

public void setJavaScript(string javascript)

Set the JavaScript validation code.

Parameters:
javascript - The javascript.

mvc\validation\rules\ZMWrapperRule.php at line 103

toJSString

public string toJSString()

Create JS validation call.

Returns:
Formatted JavaScript .

mvc\validation\rules\ZMWrapperRule.php at line 84

validate

public boolean validate(ZMRequest request, array data)

Validate the given request data.

Parameters:
request - The current request.
data - The data.
Returns:
true if the value for $name is valid, false if not.

ZenMagick 0.9.10