Class VFilledGroup
java.lang.Object
fc.web.forms.FormValidator
fc.web.forms.VFilledGroup
Validates that a group of fields is filled by the user. By default, every
field must be filled. However, optionally it can be specified that every
field in the group is not filled (all empty), only 1 field is filled or
1 or more fields (greater than zero) are filled.
-
Constructor Summary
ConstructorsConstructorDescriptionVFilledGroup
(Form f, String name, String errorMessage, Field[] fields) VFilledGroup
(Form f, String name, String errorMessage, List fields) -
Method Summary
Modifier and TypeMethodDescriptionThis is the default mode.Calling this method will result in requiring that one or more fields by filled (all the fields cannot be empty).Calling this method will result in requiring that all fields must be filled except for any one empty field.Calling this method will result in requiring that all fields be empty except for exactly one filled field (any field).boolean
Validates multiple fields together.Methods inherited from class FormValidator
getErrorMessage, getName, setErrorMessage, toString
-
Constructor Details
-
VFilledGroup
- Parameters:
fields
- a non-empty list containting fields to be checked.
-
VFilledGroup
- Parameters:
fields
- a non-empty array containting fields to be checked.
-
-
Method Details
-
onlyOneEmpty
Calling this method will result in requiring that all fields must be filled except for any one empty field. Calling this method overrides any other methods that were called previously. -
onlyOneFilled
Calling this method will result in requiring that all fields be empty except for exactly one filled field (any field). Calling this method overrides any other methods that were called previously. -
oneOrMoreFilled
Calling this method will result in requiring that one or more fields by filled (all the fields cannot be empty). Calling this method overrides any other methods that were called previously. -
allFilledOrEmpty
This is the default mode. Requires that all fields must be filled. Calling this method overrides any other methods that were called previously. -
validate
Description copied from class:FormValidator
Validates multiple fields together. Note, implementations need not call the validator for each field if that field also has a field level validator (since each field is individually validated by the form). Implementations should validate multiple fields to see if they make sense when analysed as a whole.Important notes: Typically, validation should be skipped in the following circumstances:
- The field is disabled.
- The field is an instance of
DependentField
and theinvalid reference
DependentField#shouldValidate
- Specified by:
validate
in classFormValidator
- Returns:
- true is validation succeeded, false otherwise
-