Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC:

Error on storing negative numbers? 3 years 9 months ago #4618

  • o.schwab.talking.business
  • o.schwab.talking.business's Avatar Topic Author
  • Offline
  • Posts: 8
  • Thank you received: 1
I'm using the 3.6.7 PRO Version on latest J 3.8.2.

Here's what I recongnized.

I've got a field in the Form-template called:

<dt><label for="jform_profitloss">Profit/Loss</label></dt>
<dd>{joodb form|profitloss|4}</dd>

After saving f.e. a number like "-0.00453" the negative gets deleted and is stored as "0.00453" in database.

I could not find any hint in documentation.

Any idea?

Please Log in or Create an account to join the conversation.

Error on storing negative numbers? 3 years 9 months ago #4619

  • Dirk
  • Dirk's Avatar
  • Offline
  • Posts: 1183
  • Karma: 21
  • Thank you received: 224
Could you please tell us the MYSQL FIELD TYPE of field profitloss?

Please Log in or Create an account to join the conversation.

Error on storing negative numbers? 3 years 9 months ago #4620

  • o.schwab.talking.business
  • o.schwab.talking.business's Avatar Topic Author
  • Offline
  • Posts: 8
  • Thank you received: 1
It's float(8,6)

Please Log in or Create an account to join the conversation.

Error on storing negative numbers? 3 years 9 months ago #4621

  • Dirk
  • Dirk's Avatar
  • Offline
  • Posts: 1183
  • Karma: 21
  • Thank you received: 224
Guess it's a bug.

The minus sign is stripped the form helper class.
Replace line in line 280 of /administrator/components/com_joodb/helpers/form.php
$item->{$fname}= preg_replace("/[^0-9\.,\-]/","",JRequest::getVar($fne, '', 'post', 'string'));
Or replace it with the following file

This message has an attachment file.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.

Last edit: by Dirk.

Error on storing negative numbers? 3 years 9 months ago #4622

  • o.schwab.talking.business
  • o.schwab.talking.business's Avatar Topic Author
  • Offline
  • Posts: 8
  • Thank you received: 1
what about case float?

Please Log in or Create an account to join the conversation.

Error on storing negative numbers? 3 years 9 months ago #4623

  • Dirk
  • Dirk's Avatar
  • Offline
  • Posts: 1183
  • Karma: 21
  • Thank you received: 224
Well float and decimal are basicly the same.
Your problem should be solved now.

Btw float(8,6) is not correct because its much to large!!!!
Please use only FLOAT!!!

You mean decimal(8,6)

But this would be for numbers with 2 digits and 6 digits after the point.
12.345678

For Currencies you should choose 8,2

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: Dirkjoest