ZenMagick 0.9.6


org.zenmagick.validation.rules.ZMListRule

Class ZMListRule

ZMObject
|
+--ZMRule
|
+--ZMListRule

public class ZMListRule
extends ZMRule

List validation rules.

Validate against a list of allowed values.

Author:
DerManoMann
Version:
$Id: ZMListRule.php 2158 2009-04-16 01:34:04Z dermanomann $

Constructor Summary

ZMListRule(string name, mixed values, string msg)

Create new list rule.

Method Summary
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

ZMListRule

public ZMListRule(string name, mixed values, string msg)

Create new list rule.

Parameters:
name - The field name.
values - The list of valid values as either a comma separated string or array.
msg - Optional message.

Method Detail

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 regular expression does match.

ZenMagick 0.9.6