Browse Source

fixes #2441

svn changeset:6499/svn branch:trunk
tags/6.7.0.beta1
Matti Tahvonen 15 years ago
parent
commit
8cbf189fe4
1 changed files with 12 additions and 1 deletions
  1. 12
    1
      src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java

+ 12
- 1
src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java View File

@@ -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);

Loading…
Cancel
Save