TextField setValue problem

Somehow I don’t get it. I have a
and I would like to change field value after last inserted character. I’m trying to do this when
occurs. But f
ield.setValue(“new value”);
doesn’t work. I can’t find solution in other posts so is this a bug?

input.addListener(new FieldEvents.TextChangeListener() {

			private static final long serialVersionUID = 1L;

			public void textChange(TextChangeEvent event) {
				int pos = event.getCursorPosition();
			        char last = event.getText().charAt(pos - 1);
				input.setValue("some funny text here");

Any ideas?
Thank you,

How do mean: “it doesn’t work”? What result are you getting.

Looking at your code, every time you enter a character in the text box i.e., trigger a text change event, the Textfield will clear and replace its value with: “some funny text here”.

The TextChange Event is triggered more than once. And on second event field value is blank and so setValue method sets value of the field to blank.


I’m having exactly the same problem … Anyone found any solution?


You need to set input.setReadOnly(false);