Class EqualInputValidator
- java.lang.Object
-
- org.apache.wicket.behavior.Behavior
-
- org.apache.wicket.markup.html.form.validation.AbstractFormValidator
-
- org.apache.wicket.markup.html.form.validation.EqualInputValidator
-
- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IFormValidator
,IComponentAwareHeaderContributor
,IClusterable
- Direct Known Subclasses:
EqualPasswordInputValidator
public class EqualInputValidator extends AbstractFormValidator
Validates that the input of two form components is identical. Errors are reported on the second form component with key 'EqualInputValidator' and the variables:- ${input(n)}: the user's input
- ${name}: the name of the component
- ${label(n)}: the label of the component - either comes from FormComponent.labelModel or resource key [form-id].[form-component-id] in that order
- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EqualInputValidator(FormComponent<?> formComponent1, FormComponent<?> formComponent2)
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormComponent<?>[]
getDependentFormComponents()
void
validate(Form<?> form)
This method is ran if all components returned byIFormValidator.getDependentFormComponents()
are valid.-
Methods inherited from class org.apache.wicket.markup.html.form.validation.AbstractFormValidator
bind, error, error, error, error, resourceKey, variablesMap
-
Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onComponentTag, onConfigure, onEvent, onException, onRemove, onTag, renderHead, unbind
-
-
-
-
Constructor Detail
-
EqualInputValidator
public EqualInputValidator(FormComponent<?> formComponent1, FormComponent<?> formComponent2)
Construct.- Parameters:
formComponent1
- a form componentformComponent2
- a form component
-
-
Method Detail
-
getDependentFormComponents
public FormComponent<?>[] getDependentFormComponents()
- Returns:
- array of
FormComponent
s that this validator depends on
-
validate
public void validate(Form<?> form)
Description copied from interface:IFormValidator
This method is ran if all components returned byIFormValidator.getDependentFormComponents()
are valid.To report validation error use
FormComponent.error(org.apache.wicket.validation.IValidationError)
by using any of the dependent form components or extend from AbstractFormValidator and use itsAbstractFormValidator.error(FormComponent, String, java.util.Map)
method.- Parameters:
form
- form this validator is added to
-
-