Hi All,
I'm in my first day or so with ajax.net pro and I love it. Thanks to
everyone here for making it a really great tool.
I made an autocomplete based off of Micheal's example, except that I
added an onblur event and a second function. Basically, the concept is
that the first function queries a SQL table and autocompletes, then
onBlur, another function is called which takes the value from the
auto-completed field and makes another trip to sql with it.
The problem is that the onblur event seems to be called before the
auto-completed value is bound to the autocompleted field...
At first glance I thought it was a callback queueing issue, but now I
think it must just be because onblur is the first event fired - and
actually happens before the selected value is bound/applied to the
autocomplete field. Can someone confirm this, provide a suggestion, or
point me in the direction of some good reading material?
I'm a c# guys - so i'm new to javascript and reading as much as i can
along the way -i apologize if it's a simple javascript thing i missed.
thanks all!
________________________________________________________
<script type="text/javascript" src="scripts/autocomplete.js"></script>
<script type="text/javascript">
function init()
{
var x = new MS.Web.AutoCompleteDataTable("searchCLMTNumber", 12);//
x.getDisplay = function(item)
{
return (item != null ? item.matterNum : "");
}
x.getValue = function(item)
{
return (item != null ? item.matterNum.toString().trimRight() :
"");
}
x.getData = function()
{
AutoComplete.Search(this.ele.value, this.count,
this.callback.bind(this));
}
}
setTimeout(init, 1);
var OBValidator = Class.create();
OBValidator.prototype = {
initialize: function(ele)
{
this.ele = ele;
this.display = document.getElementById("lbl" + this.ele.id);
addEvent(this.ele, "blur", this.dosearch.bind(this));
},
dosearch: function()
{
AutoComplete.GetCaseName(this.ele.value,
this.ondata.bind(this));
},
ondata: function(res)
{
if(res.value != "")
{
this.display.innerHTML = "Case Name: " + res.value;
}
}
};
function valid()
{
var y = new
OBValidator(document.getElementById("searchCLMTNumber"));
}
</script>
<br />
Client Matter Number: <input type="text" autocomplete="off"
id="searchCLMTNumber" onblur="valid();" style="width: 258px" />
<br />
<br />
<span id="lblsearchCLMTNumber">Case Name: </span>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" 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/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info/
Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
-~----------~----~----~----~------~----~------~--~---