OptionGroup Not Resetting

I have an OptionGroup:

[code]
OptionGroup tenderType = new OptionGroup(“TENDER TYPE”);
for(String listItem : tenderList){

        tenderType.addItem(new String(listItem));
        
    }
    tenderType.setRequired(true);
    tenderType.addStyleName("test");
    tenderType.setImmediate(true);
    tenderType.setMultiSelect(true);
    tenderType.setPropertyDataSource(item.getItemProperty("tenderCollection"));

[/code]That is working correctly.

However, once an option is selected, then deselected right afterwards, and NO other options are selected, the value of the first selection remains. (So if the form is submitted,the validator thinks there is a value there)

Anybody seen this issue?

Thanks!

Remove this line:

tenderType.setRequired(true); It seems that a required option group can’t be cleared.

Tried it with no change. I also need it to be required.

Thanks Max!

I resolved it this way (Doesn’t look pretty but it works…)

tenderType.addValueChangeListener(new Property.ValueChangeListener() {
            
            String temp="";
            int size = 0;
            ArrayList<Integer> tenderSize = new ArrayList<Integer>(); 
            /**
             * 
             */
            private static final long serialVersionUID = 1L;

            @Override
            public void valueChange(ValueChangeEvent event) {

                tenderSize.add(transInfo.getTenderCollection().size());
                size=tenderSize.size();
                if (transInfo.getTenderCollection().size()==1){
                    for(String out: transInfo.getTenderCollection()){
                        try{    
                            if(out.contentEquals(temp)&&tenderSize.get(size-2)!=2){
                                temp="";
                                transInfo.getTenderCollection().clear();
                                tenderSize.clear();
                                tenderSize.add(0);
                                
                            }else{
                                temp=out;
                            }
                        }catch(ArrayIndexOutOfBoundsException e){
                            temp=out;
                        }
                    }
                }
            }
        });