Clearing Select Field

Is the there a way to clear a Select field when it is recieves focus other than doing this ?

_sel.addListener(new FocusListener() {			
			@Override
			public void focus(FocusEvent event) {				
				_sel.setValue(null);
			}
		});

Thanks.

Not that I come to think of. Is there something wrong with your current implementation?

Nothing actually. Except that I have extended the Vaadin Select such that, setValue(null) will cause an exception & Also there is the Master Slave Select caching issue http://dev.vaadin.com/ticket/4607

So methinks It would be nice to have a method like


select.clearFieldText(); 

or if it exist already as evident in ComoboBox input prompt when it receives focus.

Well, if you think on select(null) it sounds, at least to me, select nothing, ie. clearing the selection. Now I don’t know the background of your application or the reasons why you don’t allow select(null) but as you already have extended the Select component, couldn’t you implement a clearFieldText() that could internally call select(null) without throwing an exception? The function would be a little redundant in core Vaadin when select(null) is allowed and meant to use.

#4607 seems to have been fixed in 6.3.3 and you were able to work around it by calling an extra select(null) after you changed the container.

You are right. I have fixed my issues already.

Thanks! You replied 6:31am, awesome.-_-

9:31am my time. I think the forum show all times in your local timezone. I’m not
that
fanatic about Vaadin! :stuck_out_tongue:

Good that you got it solved!