PDA

View Full Version : [1.2.3] Empty Text does not hide when dragging in text from another field



cravemusic
19 Mar 2009, 8:29 AM
To reproduce:
1. Select the word "Value" in the second field.
2. Click and drag the selection to the empty field.

Results:
1. "Empty Text" does not disappear.
2. The dragged in word and the empty text become concatenated -- "Empty TextValue".
3. Firefox only - word color remains light gray.

Expected:
1. Empty text hides/is removed after releasing the mouse to "drop" the dragged in text.
2. Text color is the standard value color, not the empty text color.

Reproducible in Firefox 3, Safari 3, and IE 7.



public void onModuleLoad() {
TextField<String> field = new TextField<String>();
field.setEmptyText("Empty Text");

TextField<String> field2 = new TextField<String>();
field2.setValue("Value");

RootPanel.get().add(field);
RootPanel.get().add(field2);
}

sven
19 Mar 2009, 10:25 AM
This will be hard to fix as browsers dont fire any events on textdrop. It is silent without any notification.

cravemusic
1 Apr 2009, 4:05 PM
This will be hard to fix as browsers dont fire any events on textdrop. It is silent without any notification.

That's not true. The browsers have an onchange event that covers this case. Here's a snippet of code to prove it:



<html>
<head>
<script type="text/javascript">
function onchangeListener(x)
{
var y=document.getElementById(x).value;
document.getElementById(x).value="changed!";
}
</script>
</head>
<body>

Drag me to the box <input type="text" id="test" onchange="onchangeListener(this.id)">

</body>
</html>


Works in Safari and IE. FF3 does not auto focus the text box like the other browsers, so this particular example doesn't work in FF3. But, the point is, the existing browser events more than adequately cover this situation, so this is indeed a valid bug.