Results 1 to 6 of 6

Thread: default numberfield validation doesn't trigger any change on input change

  1. #1

    Join Date
    Apr 2019
    Location
    Italy
    Posts
    5

    Default default numberfield validation doesn't trigger any change on input change

    Hi! here the problem: I have a longitude field with xtype of numberfiled already filled with: 13.27344, when I change paste the new value into field: 44.111111°, the default numberfield validation remove the "weird / not number char ° ". At this point the input become valid: 44.111111, but when I send the form to backend (PATCH), the new value is not sent cause the viewmodel doesn't recognize it as a change. Any suggestion / hint on how to fix this issue?

  2. #2
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    569
    Answers
    7

    Default

    Hello,

    Thank you for contacting Sencha Support!

    I would request you to provide a fiddle reproducing the issue to assist you in a better way.

    Regards,
    Kumar
    Sencha Support.

  3. #3

    Join Date
    Apr 2019
    Location
    Italy
    Posts
    5

    Default

    Hi, thanks for the quick reply. You can reproduce with all numberfield. The problem is inside FormFieldBase.js, on method publishValue:
    Code:
        publishValue: function () {
                 var me = this;
                 if (me.rendered && !me.getErrors().length) {
                         me.publishState('value', me.getValue());
                 }
        }
    So if the field doesn't pass the validation, we don't push the state!!! This is what happen:

    You add the input 44.111111° --> rawToValue() -> processRawValue() -> getRawValue() --> at this point the control come back to rawToValue() -> fixPrecision() -> parseValue() -> parseFloat(). The parseFloat() method will remove the ° character! At this point the input is valid? We don't know because in certain cases we want different behaviors:


    • parseFloat(44.111111°) --> 44.111111
    • parseFloat(44.123°456°) --> 44.123


    By the way, I added an override for FormFieldBase.js that through a config let you control the if statement condition me.rendered && (foo ? true : !me.getErrors().length))

    What do you think?
    Thanks for the support and your time!

  4. #4
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    569
    Answers
    7

    Default

    Hello,

    I request you to please confirm the issue which i'm able to reproduce in the fiddle is the same as which you are facing. For more details please see the below fiddle.I'm assuming you were using the classic toolkit.

    https://fiddle.sencha.com/#view/editor&fiddle/2sis

    Steps to Reproduce : Run the fiddle and paste some number like 25 in First Field, then Second Field is also updated since both are binded to the same value but when you paste some invalid number like "44.111111°" in First Field and tab out the field you will observe Second Field value is not updated(Same like First Field)


    Regards,
    Kumar
    Sencha Support.

  5. #5

    Join Date
    Apr 2019
    Location
    Italy
    Posts
    5

    Default

    Hi Rakumar, thanks for the reply! Yes, I can confirm is the same issue and yes, I'm using classic toolkit v6.2.1

  6. #6
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    569
    Answers
    7

    Default

    Hello,

    Thank you for contacting Sencha Support!

    I have registered this as a bug in our tracker with reference number EXTJS-28602, the ticket will be linked here for you to receive updates on the status.

    Regards,
    Kumar
    Sencha Support.

Posting Permissions

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