I like the example on the page but had to use SVN to pull it down and then hunt down the .js file. A bit much for the avg person to want to go through to find the code.
Tip: If you can post the code, then you will more likely get responses and even code fixes.
On that note - after reading the code it seemed that if the field contained a value already, it would not function properly and sure enough - it didn't - here is a fix.
I also updated it so you can pass an element a dom or a string id field.
I normally wouldn't post your code here when you didn't in the first place, but in this case it is the best way for me to show you the fixes / enhancements - hope you don't mind.
Code:
/**
* @author schiesser
* 6-12-2009 - Bug fixes / enhancement by Joseph Francis
*/
Ext.ns('Extensive.behaviours');
Extensive.behaviours.setInfoText = function(element, infoText, infoClass){
infoClass = infoClass || 'extensive-info-text';
//--- updated to allow and element, dom or text id to be passed
var element = element.dom ? element : Ext.get(element);
//--- set value here using dom to assure it works when it has and does not have a value
var value = element.dom.value;
//--- updated to work properly in the event that the field initially contains a value
if (element.dom.value === '' ){
element.dom.value = infoText;
element.addClass(infoClass);
}
var onBlur = function(e){
value = e.target.value;
if (value === '') {
e.target.value = infoText;
Ext.fly(e.target).addClass(infoClass);
}
};
var onFocus = function(e){
Ext.fly(e.target).removeClass(infoClass);
if (value === '') {
e.target.value = '';
}
};
element.on('focus', onFocus);
element.on('blur', onBlur);
};