Problem with setting emptyText property of TextField

  1. #1

    Problem with setting emptyText property of TextField

    Am I missing something here? I've done a lot of searching in the forums and the solutions I've found haven't worked for me (most of the posts are a few years old so maybe the syntax has changed).

    How do you change the EmptyText property of a TextField in Ext 4.7 using javascript?

    Here is my javascript below... everything else behaves as I would expect it to (so I know I have the function wired up correctly). The only thing not working is the change to emptyText.

    applyEmptyText is throwing a javascript error. If I don't have that line, I don't get any errors, but the emptyText still isn't updated.

    <script type="text/javascript">
    
        var handleRadioChange = function () {
    
            var isNameSearch = App.radioGlobalName.checked;
    
            if (isNameSearch) {
                App.txtPrimarySearch.reset();
                App.txtSecondarySearch.reset();
                App.txtPrimarySearch.emptyText = 'Enter Last Name';
                App.txtPrimarySearch.applyEmptyText();
                App.txtPrimarySearch.setWidth(145);
                App.txtSecondarySearch.show();
            }
            else {
                App.txtPrimarySearch.reset();
                App.txtSecondarySearch.reset();
                App.txtPrimarySearch.emptyText = 'Enter ADID';
                App.txtPrimarySearch.applyEmptyText();
                App.txtPrimarySearch.setWidth(295);
                App.txtSecondarySearch.hide();
            }
    
            App.storeEmployeeList.removeAll();
        }
    
    </script>
  2. #2
    Hello @craigthames!

    Where did you get this applyEmptyText() method from? It does not exist; may have in another version. Did you get this usage from our examples in Examples Explorer? Use setEmptyText(value) instead.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    I'll give that a try. I got the applyEmptyText from a few different suggestions in forum posts. But as I mentioned, those were a little dated, so I figured it might be obsolete.
  4. #4
    Worked like a charm. I'm surprised I didn't find that earlier. Thanks so much for the help!

Similar Threads

  1. Replies: 2
    Last Post: Feb 02, 2015, 9:33 AM
  2. [CLOSED] Textfield: Problem with EmptyText in IE 10
    By supera in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 04, 2014, 12:39 PM
  3. Replies: 4
    Last Post: Jan 04, 2012, 4:38 AM
  4. Replies: 2
    Last Post: Dec 20, 2011, 8:18 AM
  5. Replies: 8
    Last Post: Aug 04, 2010, 12:24 PM

Tags for this Thread

Posting Permissions