From 8cbf189fe406115e8d4499a38fe4f8987820eb1a Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Mon, 12 Jan 2009 09:24:05 +0000 Subject: [PATCH] fixes #2441 svn changeset:6499/svn branch:trunk --- .../terminal/gwt/client/ui/IFilterSelect.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java index 2644077e9f..a3e8af4a37 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java @@ -434,7 +434,12 @@ public class IFilterSelect extends Composite implements Paintable, Field, } if (allowNewItem) { - if (!enteredItemValue.equals(emptyText)) { + if (!enteredItemValue.equals(emptyText) + && !enteredItemValue.equals(lastNewItemString)) { + /* + * Store last sent new item string to avoid double sends + */ + lastNewItemString = enteredItemValue; client.updateVariable(paintableId, "newitem", enteredItemValue, immediate); } @@ -520,6 +525,11 @@ public class IFilterSelect extends Composite implements Paintable, Field, private int suggestionPopupMinWidth = 0; private static final String CLASSNAME_EMPTY = "empty"; private static final String ATTR_EMPTYTEXT = "emptytext"; + /* + * Stores the last new item string to avoid double submissions. Cleared on + * uidl updates + */ + private String lastNewItemString; public IFilterSelect() { selectedItemIcon.setVisible(false); @@ -612,6 +622,7 @@ public class IFilterSelect extends Composite implements Paintable, Field, suggestionPopup.updateStyleNames(uidl); allowNewItem = uidl.hasAttribute("allownewitem"); + lastNewItemString = null; currentSuggestions.clear(); final UIDL options = uidl.getChildUIDL(0); -- 2.39.5