This is a migrated thread and some comments may be shown as answers.

Fully qualified name for $find() method

4 Answers 148 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
dingjing
Top achievements
Rank 2
dingjing asked on 04 Apr 2008, 02:50 PM
What is the fully qualified name for $find()?

I can use $find() within other functions without problem. For example,
function FindCombo(idCombo){ 
    var combo = $find(idCombo); 
    combo.set_text("Here I am!"); 
 

But if I try to use it at top-level, like this:
var MyObject = new Object(); 
MyObject.combo = $find("MyComboId"); 
I get "$find not defined" error.

Similar error happens when I try to use shortcut method $get(). I use its fully qualified name (document.getElementById), then it is OK. So I guess if I use $find's full name, it should solve the problem.

4 Answers, 1 is accepted

Sort by
0
Thomas
Top achievements
Rank 1
answered on 04 Apr 2008, 03:34 PM
Are you using the ClientID like so:

function FindCombo(idCombo) 
{  
    var combo = $find("<%=this.MyCombo.ClientID %>");  
    combo.set_text("Here I am!");  
}  
 
or 
 
var MyObject = new Object();  
MyObject.combo = $find("<%=this.MyCombo.ClientID %>");  

0
dingjing
Top achievements
Rank 2
answered on 04 Apr 2008, 03:43 PM
If I was not using the correct ID, the error would be using null object, not "$find undefined"
0
Thomas
Top achievements
Rank 1
answered on 04 Apr 2008, 04:36 PM
True. Then my guess would be that there is something amiss with the Ajax Extensions configuration. In other words, there is either something missing from the web.config file or the Extensions are not installed etc.
0
dingjing
Top achievements
Rank 2
answered on 04 Apr 2008, 04:57 PM
I got it.

$find is a shortcut for Sys.Application.findComponent. It can only be used after AJAX library has been loaded.
Tags
ComboBox
Asked by
dingjing
Top achievements
Rank 2
Answers by
Thomas
Top achievements
Rank 1
dingjing
Top achievements
Rank 2
Share this question
or