FormInterface¶
-
public interface
FormInterface
¶
Methods¶
addField¶
-
void
addField
(FieldInterface field)¶
disableCheck¶
-
void
disableCheck
(CheckInterface check)¶ Disable a validation check
Parameters: - check –
getErrors¶
getField¶
-
FieldInterface
getField
(String fieldName)¶
getFields¶
-
Map<String, FieldInterface>
getFields
()¶
getValidator¶
-
ValidatorInterface
getValidator
()¶ The validator this form will be using to validate the inner forms.
getValue¶
getValues¶
-
Map<String, Object>
getValues
()¶ Return the values of each field on the form.
The returned values depends on the
field
some fields the values is a string whilst others its a list of string.Consult the specific
field
to get the returned value.Throws: Returns: a map, where keys a field identifier used when adding field to form and values are the fields respective values.
isValid¶
-
boolean
isValid
()¶ This is the entry point for form validations.
It firsts invokes the
validate()
to get the form wide validation .It the tells the validator to run the validation check.
Returns: true only if the validation checks passed.
removeField¶
-
void
removeField
(FieldInterface field)¶
save¶
-
void
save
()¶ This is where you should put you saving logic.
throw FormException if validation fails.
Throws:
setValue¶
validate¶
-
void
validate
()¶ This is the right place to perform form wide validations. That is validating fields against each other, also validate against parent form fields.
At this point you have access to the getValues() of both parent form and current form you can use this values to compare against.
The recommend approach is to a create check that implements FormAwareInterface and add it to the validator.
This method is invoked before the field specific validations have been run.