How to perform validatation OptionGroup

Hi,

  1. trying to validate an
    OptionGroup
    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
    setRequired(true)
    and
    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
    commit()
    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) {
		super(aErrorMessage);
	}

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

	@Override
	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;
                      }}