Negative value in money type

Talk about implementing of customized templates

Moderators: ne_moj, zewa

hermanfransen
Junior
Junior
Posts: 11
Joined: Jan 19th, '09, 13:47
Location: Amsterdam - The Netherlands

Negative value in money type

Postby hermanfransen » May 8th, '13, 16:06

I have a field (type money) that can be changed:

'extra_costs' =>array('header'=>'Overige kosten', 'type'=>'money', 'req_type'=>'sns', 'width'=>'60px', 'title'=>'', 'readonly'=>'false', 'maxlength'=>'-1', 'default'=>'', 'unique'=>'false', 'unique_condition'=>'', 'visible'=>'true', 'on_js_event'=>'', 'sign'=>'€', 'sign_place'=>'before', 'decimal_places'=>'2', 'dec_separator'=>',', 'thousands_separator'=>'.'),

How can I enter a negative amount value? When I do so I get an error message:

The <Overige kosten> field must be a signed numeric value! Please, re-enter.

administrator
Site Admin
Site Admin
Posts: 5938
Joined: Jan 7th, '09, 23:18
Contact:

Re: Negative value in money type

Postby administrator » May 9th, '13, 06:23

Try
'req_type'=>'snu'
- or -
'req_type'=>'sfu'

Does it help now?

hermanfransen
Junior
Junior
Posts: 11
Joined: Jan 19th, '09, 13:47
Location: Amsterdam - The Netherlands

Re: Negative value in money type

Postby hermanfransen » May 10th, '13, 08:51

No doesn't work: 'req_type'=>'snu', 'req_type'=>'sns', 'req_type'=>'sn', 'req_type'=>'sfu', 'req_type'=>'sfs', 'req_type'=>'sf'

'extra_costs' =>array('header'=>'Overige kosten', 'type'=>'money', 'req_type'=>'sns', 'width'=>'60px', 'title'=>'', 'readonly'=>'false', 'maxlength'=>'-1', 'default'=>'', 'unique'=>'false', 'unique_condition'=>'', 'visible'=>'true', 'on_js_event'=>'', 'sign'=>'&euro;', 'sign_place'=>'before', 'decimal_places'=>'2', 'dec_separator'=>',', 'thousands_separator'=>'.'),

extra_costs: MySQL: decimal(4,2)

When I enter value: -0,23, I get the message:
The <Verzendkosten> field must be a signed numeric value! Please, re-enter

When I enter value: -4, I get the message:
The <Overige kosten> field must be a signed numeric value! Please, re-enter.

When I enter value: 12,50 everything works fine

When I enter value: 12.50 it gives no error message, but stores 99.99 in the database (best way was to store 12.50 in database and give no error message)

When I change 'type'=>'money' to 'type'=>'textbox', 'req_type'=>'sns' I can enter -0.23 with no problem.
But off course, this is not what I want.

administrator
Site Admin
Site Admin
Posts: 5938
Joined: Jan 7th, '09, 23:18
Contact:

Re: Negative value in money type

Postby administrator » May 12th, '13, 07:14

Do you mean you want to save comma (,) as a decimal point?

Use following template:

Code: Select all

'decimal_places'=>'2', 'dec_separator'=>'.', 'thousands_separator'=>','


or -

Code: Select all

'FieldName_9'  =>array('header'=>'Name_I', 'type'=>'money',      'req_type'=>'rn', 'width'=>'80px',  'title'=>'', 'readonly'=>'false', 'maxlength'=>'-1', 'default'=>'', 'unique'=>'false', 'unique_condition'=>'', 'visible'=>'true', 'on_js_event'=>'', 'sign'=>'$', 'sign_place'=>'before|after', 'decimal_places'=>'2', 'dec_separator'=>'.', 'thousands_separator'=>','),

hermanfransen
Junior
Junior
Posts: 11
Joined: Jan 19th, '09, 13:47
Location: Amsterdam - The Netherlands

Re: Negative value in money type

Postby hermanfransen » May 17th, '13, 11:26

Yes, I do exactly what you say. Is it a bug?

administrator
Site Admin
Site Admin
Posts: 5938
Joined: Jan 7th, '09, 23:18
Contact:

Re: Negative value in money type

Postby administrator » May 19th, '13, 07:01

Please send us again your field definition and a table with test values, that don't pass validation, so we could check it on our server.


Return to “Add/Edit/View Mode Templates Implementing”