ZenMagick 0.9.10


org.zenmagick.mvc.validation.rules\ZMListRule
mvc\validation\rules\ZMListRule.php at line 32

Class ZMListRule

ZMObject
└─ZMRule
└─ZMListRule

public class ZMListRule
extends ZMRule

List validation rules.

Validate against a list of allowed values.

Author:
DerManoMann

Method Summary
void

__construct(string name, mixed values, string msg, string defaultMsg)

Create new list rule.

mixed

getValues()

Get values.

void

setValues(mixed values)

Set values.

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\ZMListRule.php at line 43

__construct

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

Create new list rule.

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

mvc\validation\rules\ZMListRule.php at line 70

getValues

public mixed getValues()

Get values.

Returns:
The list of valid values as either a comma separated string or array.

mvc\validation\rules\ZMListRule.php at line 61

setValues

public void setValues(mixed values)

Set values.

Parameters:
values - The list of valid values as either a comma separated string or array.

mvc\validation\rules\ZMListRule.php at line 91

toJSString

public string toJSString()

Create JS validation call.

Returns:
Formatted JavaScript .

mvc\validation\rules\ZMListRule.php at line 81

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

ZenMagick 0.9.10