Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    bug: parseEditorValue is not called as expected

    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!

    #2
    Just don't install formatValue() - you only need formatEditorValue() and parseEditorValue() - see the doc for formatEditorValue().

    Comment

    Working...
    X