PDA

View Full Version : searchfield, how to restore the placeholder ?



Severance
20 Mar 2011, 3:13 AM
hello,

after a search, I want to restore the original placeholder text of the searchfield, how to ?

I tried :
Ext.getCmp('searchfield1').setValue("");

But it only empty the searchfield

I want to set the placeholder I have defined during the creation of the field :

xtype: 'searchfield',
placeHolder: 'Rechercher mess.'


thank you for your help

Severance
21 Mar 2011, 11:10 PM
no one ?

simiita
6 Jul 2011, 12:40 AM
I got the same problem. Do you have solved it?

Jack9
6 Jul 2011, 1:54 AM
Simply assigning text to the property sets it, when you clear the value. Does this not work for you?



<script type="text/javascript">
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
var timeline = new Ext.Panel({
id:'Test'
,fullscreen:true
,items:[
new Ext.Panel({
html:'hello'
,style:'background-color:blue;'
,items:[
new Ext.form.Text({
id:'textfieldA',
placeHolder:'mytemptext'
})
,new Ext.Button({
text:'Click me',
handler:function(){
var tfa = Ext.getCmp('textfieldA');
tfa.setValue('');
//tfa.placeHolder = 'mytemptext2'; // This doesnt matter
}
})
]
})
]

});
}
});
</script>