Results 1 to 4 of 4

Thread: Dynamically change placeHolder from searchfield.

  1. #1
    Sencha User
    Join Date
    Feb 2011
    Location
    Belgium
    Posts
    28
    Vote Rating
    0
      0  

    Default Dynamically change placeHolder from searchfield.

    Hi,

    On top of my website I have a form searchfield. It stays there for the whole duration of your visit. On the bottom I have several tabs.

    Now everytime I click a tab I want to change the text of the placeHolder of that searchfield.

    - There isn't any function like .setPlaceholder().
    - You can change it with just saying: yourseachfield.placeHolder = "new Text". If you place the searchfield component in console.log then you can see it has changed but it didn't change on screen. Even after a doLayout() the thing doesn't change on the screen.


    Any idea's?

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

    Default

    This works for me:

    Code:
        var form = new Ext.form.FormPanel({
            fullscreen : true,
            items      : [
                { xtype : 'textfield', label : 'Test', placeHolder : 'One' }
            ]
        });
    
        var textfield = form.down('field');
        setTimeout(function() {
            textfield.setPlaceHolder('Two');
        }, 500);
    After I apply this override first:

    Code:
    Ext.override(Ext.form.Text, {
        setPlaceHolder: function(text) {
            var me    = this,
                el    = me.el,
                input = el.down('input');
    
            input.set({
                placeHolder : text
            });
        }
    });
    Cheers!
    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 User
    Join Date
    Feb 2011
    Location
    Belgium
    Posts
    28
    Vote Rating
    0
      0  

    Default

    Thanks for the answer.
    I will check this tomorrow @ work

    I have seen some other people with different problems but they were sometimes fixed by small overrides from moderators or developers like yours. Are we going to see some updates soon with all this stuff? I can imagine other people could use this setPlaceHolder setter aswel

    I started out with ExtJS and did a great project with that but I have a feeling Sencha Touch still misses some properties or methodes still

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

    Default

    Now that Ext JS 4 is out the door, Sencha Touch will start gettin some love
    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. searchfield, how to restore the placeholder ?
    By Severance in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 6 Jul 2011, 1:54 AM
  2. textareafield placeHolder no use
    By perry_jia in forum Sencha Touch 1.x: Bugs
    Replies: 4
    Last Post: 15 Apr 2011, 10:10 AM
  3. Problem with SearchField (ext.ux.form.SearchField)
    By Deeeem in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 29 Jan 2011, 9:13 PM
  4. SenchaTouch Themes - how to change color of placeHolder in textfield?
    By openthesky7 in forum Sencha Touch 1.x: Discussion
    Replies: 8
    Last Post: 23 Jan 2011, 2:53 PM
  5. [CLOSED] placeHolder vs. placeholder
    By Ralph Haygood in forum Sencha Touch 1.x: Bugs
    Replies: 3
    Last Post: 18 Aug 2010, 9:49 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
  •