Whatever message this page gives is out now! Go check it out!
<html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <head> <cfajaximport tags="cfinput-autosuggest"> <script> var init = function() { autosuggestobj = ColdFusion.Autosuggest.getAutosuggestObject('state'); autosuggestobj.itemSelectEvent.subscribe(foo); } var foo = function(event,args) { var msg = ""; msg = msg + "Event: " + event + "\n\n"; msg = msg + "Selected Item: " + args[2] + "\n\n"; msg = msg + "Index: " + args[1]._nItemIndex + "\n\n"; alert(msg); } var getStates = function(){ return ["California","Connecticut","Colorado","Illinois","Alabama","Iowa","Utah", "Alaska"]; } </script> </head> <body> <h3>Attaching an event handler to the autosuggest object</h3> <cfform name="mycfform" method="post" > State:<BR> <cfinput type="text" name="state" autosuggest="javascript:getStates({cfautosuggestvalue})" autosuggestMinLength=1 autosuggestBindDelay=1> <cfset ajaxOnLoad("init")> </cfform> </body> </html> |