public interface Dependency
A typical example includes filling later select/popup values based on the user chosen value of an earlier select in the form. So, for example, if the user chooses a country, then the later select shows the states just for that country.
There are several ways to handle dependency changes:
Orthogonal to all this is field and form validation. Validation only makes sense after we have displayed the updated fields to the user For example, initially a country popup may be empty and a state popup may be empty. When the user selects a country, then the form is submitted. At that point, the states popup is still empty and we should *not* validate the states data (i.e., not show the user a message that a state must be chosen or show a validation error for any other fields which the user hasn't filled out yet).
Validation can always be controlled by enabled/disabled flag on the field since field validators are not run for fields that are disabled. In addition, any time a field has new dependent values, the form is not validated by field validators.
|Modifier and Type||Method and Description|
Returns the initial values for the target field These are the values that are displayed when the form is first rendered.
Returns true if the submitted values are in a valid range of values.
Writes out data to keep track of dependency state.
The inverse of
Sets new values for target field in the FormData object.
void updateValues(FormData fd, HttpServletRequest req) throws DependencyException
Note:This method invoke
if it sets new values in the formdata object. New values are values that
are different from the values that were last displayed to the client.
There are 2 conditions that typically must be satisfied for this to be true:
void setDependencyDataFromSubmit(FormData fd, HttpServletRequest req)
renderDependencyData, sets any depedency data submitted as part of the form. This data is set in the specified
FormDataobject and can be later used by the
void renderDependencyData(FormData fd, java.io.Writer writer) throws java.sql.SQLException, java.io.IOException
java.lang.Object getInitialValues(Field f)
If there is no initial data, the returned object can also be null or an empty data object, depending on what the target field expects when there is no data.
boolean isSubmitDataValid(FormData fd)
If this method is not applicable, this method should return true every time.