ZenMagick 0.9.6


org.zenmagick.validation.rules.ZMMaxFieldLengthRule

Class ZMMaxFieldLengthRule

ZMObject
|
+--ZMRule
|
+--ZMMaxFieldLengthRule

public class ZMMaxFieldLengthRule
extends ZMRule

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

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

Constructor Summary

ZMMaxFieldLengthRule(string name, string table, string column, string msg)

Create new min length rule.

Method Summary
string

getErrorMsg()

Return an appropriate error message.

protected int

getMaxFieldLength()

Get the field length.

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

ZMMaxFieldLengthRule

public ZMMaxFieldLengthRule(string name, string table, string column, string msg)

Create new min length rule.

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

Method Detail

getErrorMsg

public string getErrorMsg()

Return an appropriate error message.

Returns:
Localized error message.

getMaxFieldLength

protected int getMaxFieldLength()

Get the field length.

Returns:
The max field length.

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