Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autosuggest text box gives "Object Required" on page load

Status
Not open for further replies.

clanm

Programmer
Joined
Dec 26, 2005
Messages
237
Location
US
Hello!

I'm trying to use the Autocomplete for the AjaxPro.dll from:

I keep getting "Object Expected" in my javascript on my .js include file along with that in the HTML body when the page first loads.

I've added this to my web.config file:
<httpRuntime maxRequestLength="102400"/>
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
</httpHandlers>
</system.web>

**********
**********
My code behind is trying to return names from my table (for starters) so I can see the names with the autosuggest:

<AjaxPro.AjaxMethod()> _
Public Function SearchAdvanced(ByVal orderNumber As String, ByVal customerID As Integer, ByVal count As Integer) As DataTable
Dim ds As DataSet = New DataSet
Dim sCon1 As New SqlConnection
sCon1.ConnectionString = Session("DBDDL")

Dim cmd As New SqlCommand("SELECT Authority FROM Signature_Authority_Names WHERE Authority like @CustomerID") '+
'"AND OrderNumber LIKE @OrderNumber " +
'"ORDER BY OrderNumber, PartNumber, JobNumber", conn)

cmd.Parameters.Add("@CustomerID", customerID)
'cmd.Parameters.Add("@OrderNumber", orderNumber + "%")

Try
sCon1.Open()

Try
Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)
da.Fill(ds)
Finally
sCon1.Close()
End Try
Catch
Return Nothing
End Try
'Return ds.Tables
Return ds.Tables(0)

End Function

**********
**********
My HTML is:
<body>
<script type="text/javascript" src="scripts/autocomplete.js"></script>
<script type="text/javascript">

//Code for Autocomplete
function init() {
var x = new MS.Web.AutoCompleteDataTable("searchCustomerID", 10);

x.getDisplay = function(item) {
return (item != null ? item.Authority : "");
}
x.getValue = function(item) {
return (item != null ? item.Authority.toString().trimRight() : "");
}
x.getData = function() {
Namespace.ClassName.AjaxMethod(this.ele.value, this.count, this.callback.bind(this));
}
}
addEvent(window, "load", init); //error received on this line
//End Code for Autocomplete

</script>

<form id="Form1" method="post" runat="server">
<TABLE id="Table1">
<TR>
<TD><INPUT id="searchCustomerID" type="text" size="62">
</TD>
</TR>
</TABLE>
</form>

....I get an error on the line for addEvent(window, "load", init); saying "Object Expected"

**********
**********
My first error, "object expected" is received in this .js file on line one:

addNamespace("MS.Web.AutoComplete");

MS.Web.AutoComplete = Class.create();

Object.extend(MS.Web.AutoComplete.prototype, {
timer: null,
count: 10,
pos: -1,
waitAfterInput: 230,
minChars: 0,
children: null,

I'm using IE6 Sp2
 
It sounds like you are missing a JavaScript library include. Where is "addNamespace" defined? If you're not defining it, them of course you'll get an error.

Re-read the instructions (or view the source) and see if you can find which libraries you need to include.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top