[MGNLUI-6896] TextFieldDefinition with "Double" or "Decimal" type should not round input values Created: 05/Oct/21  Updated: 20/Dec/21  Resolved: 13/Dec/21

Status: Closed
Project: Magnolia UI
Component/s: content types
Affects Version/s: 6.2.11
Fix Version/s: 6.2.15

Type: Bug Priority: Major
Reporter: Khoa Nguyen Assignee: Sang Ngo Huu
Resolution: Fixed Votes: 0
Labels: VN-Implementation, converter, double
Remaining Estimate: Not Specified
Time Spent: 1d 7h
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-4066 TextFieldDefinition with "Double" or ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Documentation update required:
Yes
Date of First Response:
Sprint: Saigon 73, UI Maintenance 3
Story Points: 3

 Description   

This is a copy of a resolved ticket MGNLUI-4066.. I experience the same behaviour on content apps/types that are of type Decimal and it was actually the same use case as in the ticket mentioned (saving coordinates) which then get rounded/modified.

Steps to reproduce:

  1. Create a dialog with the following field:
        imageAltText:
          $type: textField
          i18n: true
          type: java.lang.Double
          converterClass: com.vaadin.data.converter.StringToDoubleConverter
    
  1. Add a component/page using this dialog

Expected: Double value is stored correctly in JCR and display correctly when the dialog is reopened.
Current behaviour: Double value is stored correctly in JCR but it is truncated to 3 decimals. When the dialog is reopened (if you save the dialog again (even without any change) then the truncated value is stored in JCR).

 

Developer notes:

This was controlled by deprecated rounding factory (in servlet?) in the old framework.

Consider:

  • Use this deprecated factory (if works for v8 as well)
  • Propose alternative configuration (e.g. use String type and regexp validator for double values), documentation.


 Comments   
Comment by Mercedes Iruela [ 05/Oct/21 ]

Hello Kloa,

Thanks for reporting this issue, we were able to reproduce it. 

Best regards,

Mercedes

Comment by Ashraf Khamis [ 20/Dec/21 ]

Doc update: https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/product-docs/pull-requests/789/overview

Generated at Mon Feb 12 09:41:06 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.