Hi Sebastian,
>>Why do you need this:
>>QxWidget.flushGlobalQueues();
>>QxWidget.flushGlobalQueues();
This was done out of desperation !!! I was trying to force an update and follow the suggestion as documented in the code snippets section under the heading "forcing an update" http://old.qooxdoo.org/snippets/forcing-an-update
I could not solve the problem with my numeric QXTextField . After several tests were done it seems that the regular _expression_ works correctly, the valueField.setValue() works correctly. Only the value being displayed is not correct.
What being displayed on the console is computedValue ... i think.
Please find below the code snippets and the output for eacg test cases:
Thank you again for your help.
-----------------------------------------------------------------
var valueField = new QxTextField();
valueField.addEventListener("input", function(e) {
var text = e.getData();
var re = /[^\d]/g;
var newText = text.replace(re,"");
if (newText == ""){
alert ("match is empty string" );
valueField.setValue("")
}
else {
valueField.setValue(newText);
}
alert( e.getData());
alert( valueField.getComputedValue());
alert(valueField.getValue());
}, valueField
------------------------------------------------
Test results:
1. Enter "a" ( e.getData() = "a")
e.getData() = "a"
valueField.getComputedValue() = ""
valueField.getValue() = ""
valueField.getComputedValue() = ""
valueField.getValue() = ""
Display on console: "" (as expected)
2. Enter "b" ( e.getData() = "b")
e.getData() = "b"
valueField.getComputedValue() = "b"
valueField.getValue() = ""
valueField.getComputedValue() = "b"
valueField.getValue() = ""
Display on console: "b"
3. Enter "2" next to "b" ( e.getData() = "b2")
e.getData() = "b2"
valueField.getComputedValue() = "2"
valueField.getValue() = "2"
valueField.getComputedValue() = "2"
valueField.getValue() = "2"
Display on console: "2" (as expected)
4. Enter "c" next to 2 (e.getData() = "2c")
valueField.getComputedValue() = "2c"
e.getData() = "2c"
valueField.getValue() = "2"
e.getData() = "2c"
valueField.getValue() = "2"
Display on console: "2c"
----------------------------------------------------------------
Hi Thi!
Why do you need this:
QxWidget.flushGlobalQueues();
Makes IMHO no sense.
If "match" is really null this is an invalid value. You should normalize
it to a empty string.
textfields are always selectable by default. So there is no need to
manually do: valueField.setSelectable(true)
The drag and drop in select fields does not work, because we need to
prohibit the default drag and drop handling to be sure that qooxdoo's
built-in drag&drop handling work stable.
Hope this helps.
Sebastian
Thi Nguyen schrieb:
> Hi,
>
> I am trying to create a text field that only takes numeric by using a
> regular _expression_ to replace anything that is not a digit with null.
> The regular _expression_ works. However, the QxTextFiled.setValue() does
> not seem to worl all the way.
>
> 1. If the value entered is 1a2 then the value being displayed is "12".
> However, if the value is "abc" then the display value is "abc"
> eventhough "match" is null.
>
> 2. Also, with "valueField.setSelectable(true)", I can select a text
> field with double click but can not just drag and select.
>
> Please help me to see what I have done wrong. Here is the codesnipets.
>
> Thank you very much in advance.
>
>
> var valueField = null;
> valueField = new QxTextField(value);
> valueField.setSelectable(true);
>
> valueField.addEventListener("input", function(e) {
>
> var re = /[^\d]/g
> var text = e.getData();
> var match = text.replace(re,"");
>
> valueField.setValue(match);
> QxWidget.flushGlobalQueues();
>
> }, this );
>
> th_java
>
>
Why do you need this:
QxWidget.flushGlobalQueues();
Makes IMHO no sense.
If "match" is really null this is an invalid value. You should normalize
it to a empty string.
textfields are always selectable by default. So there is no need to
manually do: valueField.setSelectable(true)
The drag and drop in select fields does not work, because we need to
prohibit the default drag and drop handling to be sure that qooxdoo's
built-in drag&drop handling work stable.
Hope this helps.
Sebastian
Thi Nguyen schrieb:
> Hi,
>
> I am trying to create a text field that only takes numeric by using a
> regular _expression_ to replace anything that is not a digit with null.
> The regular _expression_ works. However, the QxTextFiled.setValue() does
> not seem to worl all the way.
>
> 1. If the value entered is 1a2 then the value being displayed is "12".
> However, if the value is "abc" then the display value is "abc"
> eventhough "match" is null.
>
> 2. Also, with "valueField.setSelectable(true)", I can select a text
> field with double click but can not just drag and select.
>
> Please help me to see what I have done wrong. Here is the codesnipets.
>
> Thank you very much in advance.
>
>
> var valueField = null;
> valueField = new QxTextField(value);
> valueField.setSelectable(true);
>
> valueField.addEventListener("input", function(e) {
>
> var re = /[^\d]/g
> var text = e.getData();
> var match = text.replace(re,"");
>
> valueField.setValue(match);
> QxWidget.flushGlobalQueues();
>
> }, this );
>
> th_java
>
>
Send instant messages to your online friends http://au.messenger.yahoo.com
_______________________________________________ Qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
