ZenMagick 0.9.6


org.zenmagick.validation.rules.ZMRequiredRule

Class ZMRequiredRule

ZMObject
|
+--ZMRule
|
+--ZMRequiredRule

public class ZMRequiredRule
extends ZMRule

Required validation rules.

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

Constructor Summary

ZMRequiredRule(mixed name, string msg)

Create new required 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

ZMRequiredRule

public ZMRequiredRule(mixed name, string msg)

Create new required rule.

If a list of names is specified, validation is considered teh existence of at least one.

Parameters:
name - The field name or a list (either an array or comma separated string) of names.
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 value for $name is valid, false if not.

ZenMagick 0.9.6