(400) Field validation failure on comma decimal separator

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sandro
    Junior Member
    • Nov 2022
    • 6

    (400) Field validation failure on comma decimal separator

    Hi,

    after last update to 8.0.0 i got validation error 400 on posting through api if field type is currency and data that i am sending have comma "," as decimal separator",".
    'totalAmount' : '100,00' gets error 400.
    When I replaced comma with dot everything is ok

    [2023-09-12 12:52:04] WARNING: (400) Field validation failure; entityType: Tender, field: totalAmount, type: valid.; POST /Tender; line: 56, file: /var/www/crm/application/Espo/Core/Exceptions/BadRequest.php

    Sandro
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi Sandro,

    It's not a bug. It's an expected behavior. You sent invalid value. You need to send float, integer, or a string with "." as a separator.
    Last edited by yuri; 09-12-2023, 02:37 PM.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • Firyo
      Senior Member
      • Jun 2022
      • 134

      #3
      You should check your EspoCRM configuration here
      Administration > Parameters

      Click image for larger version

Name:	image.png
Views:	196
Size:	97.8 KB
ID:	97328

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        This parameter has nothing to do with API. It only affects representation.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • Firyo
          Senior Member
          • Jun 2022
          • 134

          #5
          Originally posted by yuri
          This parameter has nothing to do with API. It only affects representation.
          Okay, didn't know.
          My bad

          Comment

          • sandro
            Junior Member
            • Nov 2022
            • 6

            #6
            Originally posted by yuri
            This parameter has nothing to do with API. It only affects representation.
            Ok Yuri, i am glad you are aware of the behavior, just wanted to say string with comma worked before update, its no more issue for me but could affect other user with middlewares.

            Comment

            • yuri
              Member
              • Mar 2014
              • 8440

              #7
              They might been working but not reliable. Now the problem is fixed with validation. Actually, it was added not in v8.0, but in v7.5.
              If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

              Comment

              Working...