ZenMagick 0.9.8


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

Class ZMWrapperRule

ZMObject
└─ZMRule
└─ZMWrapperRule

public class ZMWrapperRule
extends ZMRule

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

Author:
DerManoMann
Version:
$Id: ZMWrapperRule.php 2751 2009-12-17 22:45:44Z dermanomann $

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

toJSString()

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

Constructor Detail

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

ZMWrapperRule

public ZMWrapperRule(string name, string msg, mixed function)

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.

Method Detail

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

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 74

setJavaScript

public void setJavaScript(string javascript)

Set the JavaScript validation code.

Parameters:
javascript - The javascript.

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

toJSString

public string toJSString()

Create JS validation call.

Returns:
Formatted JavaScript .

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

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.8