Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Framework » Problem with Numeric Field
Problem with Numeric Field [message #3003] Tue, 19 June 2012 12:29 Go to next message
juanguilarte is currently offline  juanguilarte
Messages: 27
Registered: June 2012
Junior Member
When I update a record (upd1) and the numeric fields has decimal point and are not edit, this numeric field are shift like it lost de decimal point (,).
My radicore version is 1.75

Example: 175,00 is convert to 17.500,00

if they are something wrong please let me know

Thank you in advance
Re: Problem with Numeric Field [message #3004 is a reply to message #3003] Wed, 20 June 2012 02:20 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
What is your country/locale setting? All decimal points are '.' (period) internally, but are only displayed or input as ',' (comma) if your locale specifies it.

Re: Problem with Numeric Field [message #3005 is a reply to message #3004] Wed, 20 June 2012 03:01 Go to previous messageGo to next message
juanguilarte is currently offline  juanguilarte
Messages: 27
Registered: June 2012
Junior Member
My country es Venezuelas and the locale setting is like you mentioned all decimal point are '.'. and it work ok when they display the amounts with comma (decimal point) . But when the record are going to be updated and the field is not edit, the unformat function eliminated the commas and that produce a mistake with the numeric fields.
Re: Problem with Numeric Field [message #3006 is a reply to message #3005] Wed, 20 June 2012 04:58 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
I have tested this on my local PC and I cannot duplicate the problem. Input of '175000' or '175,000' is reformatted to '175000.00' for internal use, and changed to '175,000.00' when displayed on the screen.

The only way that this would be displayed as '175.000,00' is if you locale setting says that:
- decimal point is ',' (comma)
- thousands separator is '.' (period)

The formatNumber() and number_unformat() functions use the same locale settings, so I cannot see how they can get out of step.

Can you step through with your debugger and see what happens inside both of these functions?


[Updated on: Thu, 31 July 2014 03:55]

Report message to a moderator

Re: Problem with Numeric Field [message #3007 is a reply to message #3006] Wed, 20 June 2012 10:40 Go to previous messageGo to next message
juanguilarte is currently offline  juanguilarte
Messages: 27
Registered: June 2012
Junior Member
The problem occurs with the numeric fields with decimal point that are in the data base and are not going to be change (not edit), other fields are going to be change using pattern "upd1". I supposed that it occurs when it merge the $_POST array with the originaldata ($fieldarray) and when the unformat function is calle it eliminate the decimal point '.' and the numeric fields that were with the "not edit" in the screen are shiffted (for example: 175,00 are convert to 17500,00).

Re: Problem with Numeric Field [message #3008 is a reply to message #3007] Wed, 20 June 2012 15:17 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
Your locale (language = Spanish) was displaying the value "175,000.00" as "175.000,00", but because the field was set to 'noedit' the value was not being returned in the $_POST array. This meant that it was still set to "175,000.00" when it went through the number_unformat() function in the wrong format.

I've made a few tweaks to two scripts (see attached file). Can you let me know if it fixes your problem.


[Updated on: Thu, 31 July 2014 03:54]

Report message to a moderator

Re: Problem with Numeric Field [message #3009 is a reply to message #3008] Wed, 20 June 2012 18:58 Go to previous message
juanguilarte is currently offline  juanguilarte
Messages: 27
Registered: June 2012
Junior Member
I am testing all the system. At the moment everything is working ok. If i have some detail I will let you know.

Thank you very much

My regards

Juan Guilarte
Previous Topic: post insert function
Next Topic: Accessing to Radicore from mobile phones
Goto Forum:
  


Current Time: Thu Mar 28 11:17:34 EDT 2024

Total time taken to generate the page: 0.01129 seconds