I have a form field that needs to hold "firstname lastname " and
I would like to use an autosuggest event to make it work. The problem is the
angle brackets: I can get the autosuggest list to look right if I send it the
suggested values using > but then it returns the > inside the
field content. Is there some javascript I can use to replace the returned value
with the version that uses the real angle brackets?
Here's the test version of the code I'm using, adapted from the cf docs:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
var init = function()
{
autosuggestobj =
ColdFusion.Autosuggest.getAutosuggestObject('nameemail');
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";
var newmsg = msg.replace("<","<"); //just playing w/"replace"
var newnewmsg = newmsg.replace(">",">");
alert(newnewmsg);
}
var getName = function(){
return ["Joe Smith <joesm...@.com>","Jane Smythe
<jsmy...@456.com> ","Jon Gggg <j...@jgjg.net>","Clyde Farmer
<clydefar...@z.com>","Alka Seltzer
<aselt...@amazzz.com>","Pendant Hang <ph...@claws.com>","Penny Utah
<pu...@zyxwvut.net>","Amy Winston <awins...@gluggg.org>"];
}
Attaching an event handler to the autosuggest object
Name:
first last
~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348037
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm