Combobox ValueChangeListener and TextArea


I’m facing the following problem:

  • i have a comboxbox with a value change listener. When some option is selected the listener is invoked;

  • in this listener i set the value of some text area

  • after this, i modify the text in the text area and submit

  • after submit i commit the form and the listener of combobox is invoked again (the selected option in combobox was not modified) and replaced the modified text

How can i avoid this?

            final ComboBox comboBox = new ComboBox(createCaptionByPropertyId(fieldName));

	    comboBox.setContainerDataSource(new MyElementsContainer(parent, "fullName"));
	    comboBox.addListener(new MyListener());

And the listener code is:

  static private class MyListener implements Property.ValueChangeListener {

	static private final long serialVersionUID = 1L;

	private MyForm form;
	private String fieldName;

	public SelectFragmentoValueChangeListenter(final MyForm form, final String fieldName) {
	    this.form = form;
	    this.fieldName = fieldName;

	public void valueChange( event) {

	    if (event.getProperty() == null) {

	    final Long selectedItem = Long.valueOf(event.getProperty().toString());
	    final Xpto element = Xpto.INFO.get(selectedItem);

            // modify value with element text


After commit in the form, the listener is invoked and replacing all modifications …

Any ideias, how to avoid this?


Does the text area component have a listener registered?
Just a thought: could the same valueChange method be being called when the text area is updated?

No, the text area does not have any listener …

Sorry, I think I’m missing something here…

inside the valueChange listener:

Is that calling setValue on the ComboBox???
Is the intent to call the setValue on the text area???

If the listener is to change the value of the comboBox, then: turn off the listener, set the value, then turn the listener back on.

No, fieldName is different for combobox and text area. In the code i presented its not possible to check this …

I solve the problem with the solution presented in following post:

I created my own combobox and prevented calling fireEvent if commit value …