Commas for decimal place

Commas for decimal place

nico077nico077 Posts: 55Questions: 14Answers: 2

I have a problem with the commas decimal.

When I enter an amount and i use a comma instead of a point, the decimal isn't register.
Example : when i enter 50,20 the datatable save 50. But when i entrer 50.20 it's ok.

I try to use language.decimal but it doesn't work.

I try to use 'dataTables.numericComma.js' but I got the error message : 'TypeError: jQuery.fn.dataTableExt is undefined'

Best Regards,

Nicolas

This question has an accepted answers - jump to answer

Answers

  • nico077nico077 Posts: 55Questions: 14Answers: 2

    Have you got a solution please ?

  • allanallan Posts: 61,903Questions: 1Answers: 10,148 Site admin

    Hi Nicolas,

    When you say that the database is saving an integer value, what you are using to submit the value and save it? Are you using something to convert from the comma form to the period form that programming languages and databases will recognise as a floating point number?

    Allan

  • nico077nico077 Posts: 55Questions: 14Answers: 2

    Hi Allan,

    When i create a new entry or I use the bubble.
    I don't use a program to convert the comma form.

    I have read :
    https://editor.datatables.net/manual/php/formatters
    https://datatables.net/examples/basic_init/comma-decimal.html

    But I don't resolve my problem...

    Nicolas

  • nico077nico077 Posts: 55Questions: 14Answers: 2

    I want to use the columns.type function with num-fmt ? Is it the solution ?

  • allanallan Posts: 61,903Questions: 1Answers: 10,148 Site admin
    Answer ✓

    You are going to have to give me a bit more information I'm afraid. Do you want to submit a value such as "3,33" (where the comma is a decimal place)? If so, you need to use a set formatter on the server side to convert that to be a decimal number that all databases and programming languages will see as a number.

    Allan

  • nico077nico077 Posts: 55Questions: 14Answers: 2

    Thank you Allan,

    I solved the problem with :
    ->setFormatter( function($val, $data, $field) {
    return str_replace ( ',' , '.' , $val );
    }),

This discussion has been closed.