Form input with numberFormat not working as expected

Hi,

I have a form linked to a grid. The numbers in the form are formatted using numberFormat but when the data is sent to the server the number is sent in it’s formatted form instead of the unformatted version.

Please see attached example.

Any chance of a fix?
example-numberformat.part2.rar (500 KB)
example-numberformat.part1.rar (2 MB)

Hi

this is not a bug. numberFormat used just for formatting inside input, it not change original value.

Hi Andrei,

I think you may have understood me. I accept that when you enter a field that has numberFormat set it just formats what you can see. This is confirmed because when you enter the field it reverts to the actual underlying value.

However, if you change a value in the field and hit save the value sent to the datastore is the formatted value and not the unformatted value.

Surely, this cannot be correct behaviour?

hi

please provide completed demo?

sorry, see demo above,

well,

load page but do not select any row in grid, open dhtmlxform.js in a script tab, put breakpoint on line 2130, select 4th row in grid (9.13), 1st breakpoint will for address_id input, skip it (just call continue), 2nd one - for formatted value, as you can see value already have “9.13” format, according xml - also 9.13, in grid I not see formatting at all.

sorry man, crazy day today.
I finally got it. working.

dhtmlxform.js, line 2098

updateValue: function(item) {
var value = item.childNodes[item._ll?1:0].childNodes[0].value;
//add 2nd line
if (item._df != null && value == this._getFmtValue(item, value)) return;

Yes, confirmed that’s working for me as well.

Many Thanks!!

this does not work in IE7 and Google Chrome

chrome - ok
IE7 - not

open dhtmlxform.js, find:

_getFmtValue: function(item, v) {

v1 = “”+r[2][q]+v1;

change to:

v1 = “”+r[2].charAt(q)+v1;

Thanks, now it is ok!