Atozed Forums
How fix Money values with iwdbedit before save - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: How fix Money values with iwdbedit before save (/thread-1094.html)



How fix Money values with iwdbedit before save - cprmlao@hotmail.com - 06-01-2019

Hi,

I need to fix money values of a IWDBEDIT before save it to a  firebird DB table.
I use a MaskMoney JS plugin to format the money entry data.
Alter I enter data, my front end shows for sample: "$ 10,00". Next, I call an AsyncClick  of a Button as:


Code:
procedure TMyform.BtnSaveAsyncClick(Sender: TObject;  EventParams: TStringList);
begin
    // Here I´d like to fix the currency format before save to DB
    // But, is too late.  An error occur saying my entry field "$ 10,00" is not a format valid
end;

I could fix it in the front end, before call the async click. But, the field  will shows in wrong format in browser.

How could I fix it on back end before save the record?

Regards,
Luiz


RE: How fix Money values with iwdbedit before save - kudzu - 06-03-2019

The easiest way is to not databind that field and then manually load/save it to the data field.


RE: How fix Money values with iwdbedit before save - Jose Nilton Pace - 06-03-2019

Hi Luiz, in this page https://github.com/plentz/jquery-maskmoney:
Code:
.maskMoney('unmasked')
Return a float value (ex.: 'R$ 1.234,56' => 1234.56). PS: If you have only one input field, you should use this way, since it will always return an array.
Code:
.maskMoney('unmasked')[0]



RE: How fix Money values with iwdbedit before save - cprmlao@hotmail.com - 06-06-2019

(06-03-2019, 03:06 PM)Jose Nilton Pace Wrote: Hi Luiz, in this page https://github.com/plentz/jquery-maskmoney:
Code:
.maskMoney('unmasked')
Return a float value (ex.: 'R$ 1.234,56' => 1234.56). PS: If you have only one input field, you should use this way, since it will always return an array.
Code:
.maskMoney('unmasked')[0]
Thank you,

I am using it now.