ZenMagick 0.9.10


zenmagick.store.shared.mvc.validation\ZMMaxFieldLengthRule
mvc\validation\ZMMaxFieldLengthRule.php at line 30

Class ZMMaxFieldLengthRule

ZMObject
└─ZMRule
└─ZMMaxFieldLengthRule

public class ZMMaxFieldLengthRule
extends ZMRule

Max field length validation rule based on the database column length.

Author:
DerManoMann

Method Summary
void

__construct(string name, string table, string column, string msg, string defaultMsg)

Create new min length rule.

string

getErrorMsg()

Return an appropriate error message.

protected int

getMaxFieldLength()

Get the field 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
__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\ZMMaxFieldLengthRule.php at line 44

__construct

public void __construct(string name, string table, string column, string msg, string defaultMsg)

Create new min length rule.

Parameters:
name - The field name.
table - The database table.
column - The table column.
msg - Optional message.

mvc\validation\ZMMaxFieldLengthRule.php at line 88

getErrorMsg

public string getErrorMsg()

Return an appropriate error message.

Returns:
Localized error message.

mvc\validation\ZMMaxFieldLengthRule.php at line 75

getMaxFieldLength

protected int getMaxFieldLength()

Get the field length.

Returns:
The max field length.

mvc\validation\ZMMaxFieldLengthRule.php at line 98

toJSString

public string toJSString()

Create JS validation call.

Returns:
Formatted JavaScript .

mvc\validation\ZMMaxFieldLengthRule.php at line 66

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