Class VFilledOnChoice
java.lang.Object
fc.web.forms.FormValidator
fc.web.forms.VConditional
fc.web.forms.VFilledOnChoice
Validates that a certain radio or checkbox button selected
(or not selected) implies that other fields in the form are
also filled out. For example:
A radio button called "yes" is chosen by the user and this requires that a "yes_detail" field be filled out.
-
Constructor Summary
ConstructorsConstructorDescriptionVFilledOnChoice(Form f, String name, String errorMessage, ChoiceGroup cg, String choiceValue, Field[] postFields) VFilledOnChoice(Form f, String name, String errorMessage, ChoiceGroup cg, String choiceValue, List postFields) -
Method Summary
Modifier and TypeMethodDescriptionanyFilled(boolean val) By default, this validator checks to see that all post-condition fields are filled.voidonSelected(boolean val) Sets whether validation will occur if the choice is selected by the user or not.booleanpostConditionMet(FormData fd, jakarta.servlet.http.HttpServletRequest req) Subclasses should implement this method to check that certain post conditions have been met.booleanpreConditionMet(FormData fd, jakarta.servlet.http.HttpServletRequest req) Subclasses should implement this method to check that certain fields or pre-conditions have been met.Methods inherited from class VConditional
validateMethods inherited from class FormValidator
getErrorMessage, getName, setErrorMessage, toString
-
Constructor Details
-
VFilledOnChoice
public VFilledOnChoice(Form f, String name, String errorMessage, ChoiceGroup cg, String choiceValue, List postFields) - Parameters:
f- the formname- name for this validatorerrorMessage- validation error messagepostFields- a non-empty list containing fields for the post conditionchoice- a pre condition choice groupval- the specific value of the pre condition choice group which will trigger the check to see that post condition fields are filled out
-
VFilledOnChoice
public VFilledOnChoice(Form f, String name, String errorMessage, ChoiceGroup cg, String choiceValue, Field[] postFields)
-
-
Method Details
-
anyFilled
By default, this validator checks to see that all post-condition fields are filled. However, if true is specified to this method, then validation will be successful if any specified field is filled. -
preConditionMet
Description copied from class:VConditionalSubclasses should implement this method to check that certain fields or pre-conditions have been met. Only gf these conditions have been met will there be a check to see that the post conditions are also true.- Specified by:
preConditionMetin classVConditional- Returns:
- true if the pre-conditions have been met, false otherwise
-
postConditionMet
Description copied from class:VConditionalSubclasses should implement this method to check that certain post conditions have been met. This method will only be called if theVConditional.preConditionMet(FormData, HttpServletRequest)method returns true.- Specified by:
postConditionMetin classVConditional- Returns:
- true if the post-conditions have been met, false otherwise
-
onSelected
Sets whether validation will occur if the choice is selected by the user or not. By default, validation occurs when the choice is selected by the user.- Parameters:
val- true to validate only when selected false otherwise.
-