Results 1 to 4 of 4

Thread: Faults with Ext.field.Number.decimals and decimalsText

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium User
    Join Date
    Feb 2012
    Posts
    75
    Vote Rating
    46
      0  

    Default Faults with Ext.field.Number.decimals and decimalsText

    Ext.field.Number decimals config forcibly rounds the entered value to the specified number of decimal places, but only for display purposes. The field value retains any additional decimal places entered by the user.

    Pretty obvious that this is highly unintuitive and error prone!

    Ext.field.Number decimalsText config does absolutely nothing at all. As far as I can tell, it's not even implemented.

    Perhaps another config could be provided to toggle forced rounding ("forceDecimals" / "forceRounding"?) - which obviously should round the field value as well. And then decimalsText can be implemented.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,336
    Vote Rating
    1486
      0  

    Default

    The decimals config does state “to display” which does suggest the value is not changed.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium User
    Join Date
    Feb 2012
    Posts
    75
    Vote Rating
    46
      0  

    Default

    I think that's too subtle a distinction - if the current behaviour really is by design, the documentation could be improved to strongly draw attention to this fact.

    But I can't think of a good justification for modifying a user-entered value for presentation only, then submitting the original value. When a user submits a form, the expectation is that what they can see in the fields (whether or not values have been automatically parsed / cleaned up) is what will get submitted.

    To illustrate the principle, what if a phone number field rejected invalid characters for display purposes only, but still submitted them to the server? It doesn't make sense. In the case of the numberfield decimals config, the additional decimal precision inadvertently entered by the user equates to invalid characters being rejected. They shouldn't be preserved in the field value.

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,336
    Vote Rating
    1486
      0  

    Default

    Well, first you have to think this is how it’s been working and the impact it could have if changed. Parsing manually entered values can also frustrate users, they type something in and it doesn’t accept further digits or changes on them. I can see it both ways tbh.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Similar Threads

  1. Number Field dropping last zero in decimals
    By kitesurf in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 18 Jul 2014, 3:49 AM
  2. Force 2 decimals to show in a Number Field?
    By cswsteve in forum Sencha Architect 2.x: Help & Discussions
    Replies: 2
    Last Post: 2 Jul 2013, 7:07 AM
  3. Number rounds to two decimals in Property Grid
    By bbxx in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 25 Apr 2013, 2:59 AM
  4. Template, show a number with 2 decimals
    By PatrickS in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 11 Oct 2010, 6:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •