|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nl.openedge.baritus.validation.AbstractValidator nl.openedge.baritus.validation.AbstractFieldValidator nl.openedge.baritus.validation.impl.RequiredFieldValidator
Checks for a non-EMPTY input. Use this for fields that should have a not null (empty string) input. Note that as this validator is a field validator, and thus is registered for a single field, it is only fired if a field (e.g. a request parameter) is actually provided. In other words: if an instance of a required field validator was registered for field name 'myprop', but 'myprop' is not part of the request parameters, this validator never fires. Hence, if you want to be REALLY sure that a property of the form is not null, use a form validator (PropertyNotNullValidator). RequiredFieldValidator works fine for most cases where you have a HTML form with a field that should have a non empty value, but that - if a user fools around - does not seriousely break anything when a value is not provided (e.g. you probably have not null constraint in you database as well).
Constructor Summary | |
RequiredFieldValidator()
Construct using 'input.field.required' as the message prefix. |
|
RequiredFieldValidator(java.lang.String errorMessageKey)
Construct with errorMessageKey for error message keys. |
|
RequiredFieldValidator(java.lang.String errorMessageKey,
ValidationActivationRule rule)
Construct using errorMessageKey and the activation rule |
|
RequiredFieldValidator(ValidationActivationRule rule)
Construct using the provided activation rule and 'input.field.required' as the message prefix. |
Method Summary | |
java.lang.String |
getErrorMessageKey()
Get key of error message. |
boolean |
isValid(org.infohazard.maverick.flow.ControllerContext cctx,
FormBeanContext formBeanContext,
java.lang.String fieldName,
java.lang.Object value)
Checks whether the value is not null, and - if it is an instance of String - whether the trimmed value is not an empty string. |
void |
setErrorMessageKey(java.lang.String string)
Set key of error message. |
Methods inherited from class nl.openedge.baritus.validation.AbstractFieldValidator |
getOverrideValue |
Methods inherited from class nl.openedge.baritus.validation.AbstractValidator |
getFieldName, getLocalizedMessage, getLocalizedMessage, getLocalizedMessage, getLocalizedMessage, getValidationActivationRule, removeValidationActivationRule, setErrorMessage, setValidationRule |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface nl.openedge.baritus.validation.ValidationRuleDependend |
getValidationActivationRule, removeValidationActivationRule, setValidationRule |
Constructor Detail |
public RequiredFieldValidator()
public RequiredFieldValidator(ValidationActivationRule rule)
rule
- public RequiredFieldValidator(java.lang.String errorMessageKey, ValidationActivationRule rule)
errorMessageKey
- rule
- public RequiredFieldValidator(java.lang.String errorMessageKey)
errorMessageKey
- errorMessageKeyMethod Detail |
public boolean isValid(org.infohazard.maverick.flow.ControllerContext cctx, FormBeanContext formBeanContext, java.lang.String fieldName, java.lang.Object value)
cctx
- maverick contextformBeanContext
- context with bean for this currentRequestfieldName
- field name of parametervalue
- the value of this parameter
FieldValidator.isValid(org.infohazard.maverick.flow.ControllerContext, nl.openedge.baritus.FormBeanContext, java.lang.String, java.lang.Object)
public java.lang.String getErrorMessageKey()
public void setErrorMessageKey(java.lang.String string)
string
- key of error message
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |