Hi,
i'm having real trouble (trying and searching for multiple hours) in making a numberfield acting the way i want it to.
it's for a numberfield on a panel
remember : in europe the decimal separator is a ',' and the thousand separator is a '.'
basically i want 2 things,
When form is initially filled with data coming from Ajax/iSeries, to have those displayed with the right decimal & thousand separator
so a value of in iseries 1234,56 should be displayed as 1.234,56
and secondly when entering a value in a numberfield with f.e with decimalPrecision:2 (lets say 1234.5, when leaving the field, it should show 1.234,50)
the first i achived this by modifying the setValue method:
(by the way : this has been set initially:
xt.util.Format.thousandSeparator = '.';
Ext.util.Format.decimalSeparator = ',';
but now when changing the content of the same numfield, i have the problem that the entered value (which is reformatted by the previous setValue method) is no longer considered to be valid number.. (an error is triggered and says that '123,00 is not a valid number"
examples:
i'm totally stuck, can someone please lead me to the solution,
thx
thierry
i'm having real trouble (trying and searching for multiple hours) in making a numberfield acting the way i want it to.
it's for a numberfield on a panel
remember : in europe the decimal separator is a ',' and the thousand separator is a '.'
basically i want 2 things,
When form is initially filled with data coming from Ajax/iSeries, to have those displayed with the right decimal & thousand separator
so a value of in iseries 1234,56 should be displayed as 1.234,56
and secondly when entering a value in a numberfield with f.e with decimalPrecision:2 (lets say 1234.5, when leaving the field, it should show 1.234,50)
the first i achived this by modifying the setValue method:
(by the way : this has been set initially:
xt.util.Format.thousandSeparator = '.';
Ext.util.Format.decimalSeparator = ',';
PHP Code:
setValue: function(v){
var me=this;
edtcde = "0"+ Ext.util.Format.thousandSeparator+"0";
if (me.allowDecimals && me.decimalPrecision>0) {
edtcde+=Ext.util.Format.decimalSeparator;
for (i=1;i<=me.decimalPrecision; i++){
edtcde+='0';
}
};
vv=Ext.util.Format.number(v, edtcde+'/i');
return Ext.form.NumberField.superclass.setRawValue.call(this, vv);
},
but now when changing the content of the same numfield, i have the problem that the entered value (which is reformatted by the previous setValue method) is no longer considered to be valid number.. (an error is triggered and says that '123,00 is not a valid number"
examples:
- [1]i have a numberfield without decimals (id: QQQJAAR) on a form with value 57000
it is shown on the display as 57.000 (<== is ok)
when looking in the componentquery i get the following
x=Ext.ComponentQuery.query('#QQQJAAR')[0]
x.value: null ???
x.getValue: "57" ????? <=====
x.getRawValue: "57.000"
[2]numberfield with 2 decimals (id QQCOSTE and i overwrite blank value with 1234,56
it is shown on the display as 1.234,56 (<== is ok)
when looking in the componentquery i get the following
x=Ext.ComponentQuery.query('#QQQCOSTE')[0]
x.value: "1234.56"
x.getValue: "1.23" ????? <=====
x.getRawValue: "1.234,56"
added to those weird results, the border is shown in red together with the message 1.234,56 is not a valid number !!
i'm totally stuck, can someone please lead me to the solution,
thx
thierry
Comment