Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

bug: parseEditorValue is not called as expected

$
0
0
The bug is reproducible on older SC 9 and also on latest SmartClient 10.0p 2015-02-11
on all browsers. Reproduced on MS IE 11, FF 31.4.0 ESR, Google Chrome

Here is the sample code
Code:

isc.VLayout.create({
        members : [ isc.DynamicForm.create({
                ID : "testForm",
                width : 400,
                fields : [ {
                        name : "lastfield",
                        type : "text",
                        formatOnBlur : true,
                        formatValue : function(value, record, form, item) {
                                return this.formatEditorValue(value);
                        },
                        formatEditorValue : function(value, record, form, item) {
                                if (value && value.startsWith("x"))
                                        return value.substring(1);
                                return value;
                        },
                        parseEditorValue : function(value, form, item) {
                                if (isc.isA.String(value))
                                        return "x" + value;
                                return value;
                        }
                } ]
        }), isc.Canvas.create({
                canFocus : true,
                click : function() {
                        alert(isc.echo(window.testForm.getValues()));
                },
                contents : "Can be focused"
        }) ]
});

There is a DynamicForm with TextItem, which is at the end of the form. The TextItem has custom value formater, which adds prefix "x" to the value.
After the DynamicForm there is a focusable Canvas.

Test case:
1) type in "a" into TextItem
2) click on Canvas
the alert shows value: {lastfield:"xa"} - It is correct
3) click on TextItem
4) press key [TAB] - focus moves to Canvas
5) click on Canvas
the alert shows value: {lastfield:"a"}
bug: It is incorrect, the value prefix is missing!

Viewing all articles
Browse latest Browse all 4756

Trending Articles