View Full Version : Dynamically change placeHolder from searchfield.

2 May 2011, 6:35 AM

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 May 2011, 11:02 AM
This works for me:

var form = new Ext.form.FormPanel({
fullscreen : true,
items : [
{ xtype : 'textfield', label : 'Test', placeHolder : 'One' }

var textfield = form.down('field');
setTimeout(function() {
}, 500);

After I apply this override first:

Ext.override(Ext.form.Text, {
setPlaceHolder: function(text) {
var me = this,
el = me.el,
input = el.down('input');

placeHolder : text

Cheers! :D ;)

2 May 2011, 12:08 PM
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 :(

2 May 2011, 12:09 PM
Now that Ext JS 4 is out the door, Sencha Touch will start gettin some love