Results 1 to 2 of 2

Thread: Trim input in specific text field

  1. #1
    Sencha User
    Join Date
    Mar 2016
    Posts
    8
    Answers
    2

    Default Answered: Trim input in specific text field

    Using SA3, I have a form with a field "requestNumber". By right-clicking on it in SA, I was able to add a listener for the 'blur' event,automatically called "onRequestNumberBlur":
    Code:
     listeners: {
       specialkey: 'onRequestNumberSpecialkey',
       blur: 'onRequestNumberBlur'
    }
    In turn, I wrote the listener; the "alert" displays, showing that the listener _is_ being called, but apparently I'm using the trim function incorrectly - probably referencing the field or its value incorrectly. What's wrong with this code?
    Code:
    onRequestNumberBlur: function(component, event, eOpts) {
            alert("blur!");
            component.setValue(component.getValue().trim());
        },
    To be clear, I only want to update the text on BLUR, rather than try to suppress spaces as the user types. That approach seems a bit draconian, and the task is to restore a functionality that was in an earlier product.

  2. It turns out the code above _was_ correct! When I built the last version using SA, somehow that change did _not_ get included. When I rebuilt again (with no edits), the change _did_ get included, and then the code worked as desired. Yay!

  3. #2
    Sencha User
    Join Date
    Mar 2016
    Posts
    8
    Answers
    2

    Default

    It turns out the code above _was_ correct! When I built the last version using SA, somehow that change did _not_ get included. When I rebuilt again (with no edits), the change _did_ get included, and then the code worked as desired. Yay!

Similar Threads

  1. Replies: 4
    Last Post: 8 Feb 2013, 1:34 AM
  2. Replies: 0
    Last Post: 29 Jan 2012, 5:04 AM
  3. How to create a Field with label and html text instead of input field?
    By ihor.ko in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 25 May 2009, 2:24 AM

Tags for this Thread

Posting Permissions

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