I was wanting to add instructional text to the Autocomplete field (grey
text that goes away when you click the field). I did a bit of a hack
(which I included below). Wondering if I should make this less hack
like and submit a patch into TG?

MyCustomManager= function(name, groupid) {
        this.name = name;

        this.theAutoCompManager = eval("AutoCompleteManager" + this.name +
"_innerAutoComp");
}

MyCustomManager.prototype.initialize = function() {
        // Hijack the focus function of the autoComplete field
        this.oldFocus = this.theAutoCompManager.gotFocus;
        this.theAutoCompManager.gotFocus = this.newFocus;
        updateNodeAttributes(this.autoCompTextField, {"onfocus": this.newFocus
});

        // Make the auto comp field larger
        updateNodeAttributes(this.theAutoCompManager.textField, {"style":
"width: 50%; color: #666666"});
        this.theAutoCompManager.textField.value = "Enter name of contact to
add to list";
}

MyCustomManager.prototype.newFocus = function(event) {
        // Deal with crappy browser implementations
        event=event||window.event;
        var origReturn = this.oldFocus(event);

        // Clear out the instructions for the first time focus
        updateNodeAttributes(this.theAutoCompManager.textField, {"style":
"width: 50%; color: #000000"});
        this.theAutoCompManager.textField.value = "";

        // Reasign the old focus function
        updateNodeAttributes(this.autoCompTextField, {"onfocus": this.oldFocus
});
        
        return origReturn;
}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to