ZenMagick 0.9.6


org.zenmagick.validation.rules.ZMWrapperRule

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 2121 2009-03-31 01:56:56Z 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(array req)

Validate the given request data.

Methods inherited from org.zenmagick.validation.ZMRule
getDefaultMsg, getErrorMsg, getJSName, getMsg, getName, toJSString, validate
Methods inherited from org.zenmagick.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Constructor Detail

ZMWrapperRule

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

Create new rule.

Parameters:
name - The field name.
msg - Optional message.
function - The function name or array.

Method Detail

setFunction

public void setFunction(string function)

Set the validation function.

The function must implement the same siganture as validate($req).

Parameters:
function - The function name.

setJavaScript

public void setJavaScript(string javascript)

Set the JavaScript validation code.

Parameters:
javascript - The javascript.

toJSString

public string toJSString()

Create JS validation call.

Returns:
Formatted JavaScript .

validate

public boolean validate(array req)

Validate the given request data.

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

ZenMagick 0.9.6