How to perform validatation OptionGroup


  1. trying to validate an
    with multiselect set to true. A Validator was made but the method
    isValid(Object value)
    returns the values to validate against inside an Collections$UnmodifiableSet

The question is how to validate that the values in the Collection are indeed only valid values (code sample below) ?

  1. Also, the methods
    setRequiredError(“Error message”)
    were both sets for that OptionGroup. The red asterisks does displays allright but unfortunately no error mark if no option is selected and the form
    method is called. Any idea someone ??

public final class MyCustomValidator extends AbstractValidator {
                     private static final long serialVersionUID = 1L;
	private Set<MyCustomParameters> allowedParameters = new HashSet<MyCustomParameters>();
	public MyCustomValidator(final String aErrorMessage) {

	public MyCustomValidator(final String aErrorMessage, final Set<MyCustomParameters> aMyCustomParameters) {
		this.allowedParameters = aMyCustomParameters;

	public boolean isValid(final Object value) {
		// Problem is here, objects MyCustomParameters are wrapped into Collections$UnmodifiableSet<E> 
		if (value instanceof MyCustomParameters){
			MyCustomParameters oneMyCustomParameters = (MyCustomParameters) value;
			if (allowedParameters.contains(oneMyCustomParameters))
				return true;
		return false;