ZMObject
└─ZMRule
public abstract class ZMRule
extends ZMObject
| Fields inherited from org.zenmagick.core\ZMObject | |
|---|---|
| properties_ | |
| Method Summary | |
|---|---|
| void | __construct(string name, string defaultMsg, string msg) Create new validation rule. |
| string | Get the default error message. |
| string | Return an appropriate error message. |
| string | Get the form field name this rule is validating. |
| string | getMsg() Get the custom error message. |
| string | getName() Get the parameter name this rule is validating. |
| void | setDefaultMsg(string msg) Set the default error message. |
| void | setMsg(string msg) Set a custom error message. |
| void | setName(string name) Set the parameter name this rule is validating. |
| string | Create JS validation call. |
| abstract boolean | validate(ZMRequest request, array data) Validate the given request data. |
| Methods inherited from org.zenmagick.core\ZMObject | |
|---|---|
| __construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton | |
public void __construct(string name, string defaultMsg, string msg)
Create new validation rule.
null.null.null.public string getDefaultMsg()
Get the default error message.
public string getErrorMsg()
Return an appropriate error message.
public string getJSName()
Get the form field name this rule is validating.
This might be different in case of checkboxes or other input fields that allow multiple values. In that case PPH requires to to suffix form field names with '[]'. However, the request parameter will not have this suffix (rather being an array instead of a string).
public string getMsg()
Get the custom error message.
public string getName()
Get the parameter name this rule is validating.
public void setDefaultMsg(string msg)
Set the default error message.
public void setMsg(string msg)
Set a custom error message.
public void setName(string name)
Set the parameter name this rule is validating.
public string toJSString()
Create JS validation call.
Returns an empty string.
public abstract boolean validate(ZMRequest request, array data)
Validate the given request data.
true if the value for $name is valid, false if not.
Base class for validation rules.