ZenMagick 0.9.8


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

Class ZMMinMaxRule

ZMObject
└─ZMRule
└─ZMMinMaxRule

public class ZMMinMaxRule
extends ZMRule

Min/max length validation rule.

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

Constructor Summary

ZMMinMaxRule(string name, int min, int max, string msg)

Create new min/max length rule.

Method Summary
string

getErrorMsg()

Return an appropriate error message.

int

getMax()

Get the maximum length.

int

getMin()

Get the minimum length.

void

setMax(int max)

Set the maximum length.

void

setMin(int min)

Set the minimum length.

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\ZMMinMaxRule.php at line 44

ZMMinMaxRule

public ZMMinMaxRule(string name, int min, int max, string msg)

Create new min/max length rule.

Parameters:
name - The field name; default is null.
min - The minimun length; default is 1.
max - The maximum length; default is 0 for unlimited.
msg - Optional message.

Method Detail

\mvc\validation\rules\ZMMinMaxRule.php at line 113

getErrorMsg

public string getErrorMsg()

Return an appropriate error message.

Returns:
Localized error message.

\mvc\validation\rules\ZMMinMaxRule.php at line 90

getMax

public int getMax()

Get the maximum length.

Returns:
The maximum length.

\mvc\validation\rules\ZMMinMaxRule.php at line 72

getMin

public int getMin()

Get the minimum length.

Returns:
The minimun length.

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

setMax

public void setMax(int max)

Set the maximum length.

Parameters:
max - The maximum length.

\mvc\validation\rules\ZMMinMaxRule.php at line 63

setMin

public void setMin(int min)

Set the minimum length.

Parameters:
min - The minimun length.

\mvc\validation\rules\ZMMinMaxRule.php at line 123

toJSString

public string toJSString()

Create JS validation call.

Returns:
Formatted JavaScript .

\mvc\validation\rules\ZMMinMaxRule.php at line 101

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