Results 1 to 4 of 4

Thread: EXTJS 6.6: Can paste text into numberfield

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2009
    Cypress, Kalifornia

    Default EXTJS 6.6: Can paste text into numberfield

    Enough said. Of course when the form is validated the field is rejected. It shouldn't allow the paste to begin with. The only workaround I've calculated but not implemented is to set the "enableKeyEvents" flag to true then implement a "paste" event and reject it based on the value.

    This is a numeric field. EXTJS should be managing this, not the developer. Maybe I'm misunderstanding how this should behave?


  2. #2
    Sencha - Forum Administrator
    Join Date
    Sep 2017


    Hi Doug,

    Thank you for bringing this to our attention. I have sent this issue over to the support team to look into. Thank you for your patience while we work to fix this.


  3. #3
    Ext Support Team
    Join Date
    Jan 2018


    Hello Doug,

    Pasting values cannot be disabled as of now. Currently values are pasted but on blur the form is validated and values are removed as shown in fiddle -

    But if you don't want not allowed values to be dispalyed there are alternatives that you can use :

    Option 1 : To disable pasting

    1. Add a keydown listener and stop the event for Ctrl+V and Ctrl+Ins keys.
    2. Add a contextmenu listener and stop the event.

    1. You don't know which keys are actually configured to do a copy on the OS.
    2. You can't stop the contextmenu event on Opera.

    Option 2 : To strip the unwanted chars on paste
    You can use 'stripCharsRe' config to number/textfield. A fiddle showing its use -

    Sencha Support.

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL


    I think what Doug is getting at is this should be handled by the framework.

    The key events can be stopped easily:

    This is similar to how the clipboard plugin works, it creates a KeyMap instances only here, we get the handy keyMap config only we have to then check if the paste was on the inputEl vs the component element. Not much is gained from doing it this way vs what Doug is already doing with the enableKeyEvents and using Ext JS' paste event then except you aren't getting the key* events then too so kind of a trade off.

    This issue here is the context menu paste option. There isn't a cross-browser way of all the supported browsers to hook into the native paste event so you'd basically have to check if another event fires (like change or input on the <input> node) to see if you can then kill the value. This is sort of like what we had to do to support placeHolder in old browsers (only it was a mouse event that cleared the value iirc). If that didn't pan out, maybe a poller which is never a good idea but sometimes you aren't left with many options.

    Whatever is done, this should be opened as an improvement (could be argued for improvement or for bug) especially since Doug is labeled as a customer. I would also argue that you may want to think about having a config to enable this to not hurt people upgrading especially if you have to do a poller as that'd hurt perf a little bit, my experience is there will always be someone that enjoyed this "feature".
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:

Similar Threads

  1. [OPEN] Can paste text into numberfield
    By jtuhacek in forum Ext:Bugs
    Replies: 4
    Last Post: 21 May 2019, 5:59 AM
  2. Paste into NumberField does not work with FF
    By tp_blue in forum Ext GWT: Discussion
    Replies: 3
    Last Post: 26 Apr 2011, 6:13 AM
  3. Paste values from Excel paste buffer into Extjs Grid?
    By jimm in forum Ext 3.x: Help & Discussion
    Replies: 6
    Last Post: 11 Mar 2011, 3:40 PM
  4. Allow Copy/Paste inside NumberField
    By jeffiel in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 21 Apr 2007, 12:20 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