I have a form field that needs to hold "firstname lastname <emailaddress>" 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: <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('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 <[email protected]>","Jane Smythe <[email protected]> ","Jon Gggg <[email protected]>","Clyde Farmer <[email protected]>","Alka Seltzer <[email protected]>","Pendant Hang <[email protected]>","Penny Utah <[email protected]>","Amy Winston <[email protected]>"]; } </script> </head> <body> <center> <h3>Attaching an event handler to the autosuggest object</h3> <cfform name="mycfform" method="post" > Name:<br /> <cfinput type="text" name="nameemail" size=40 autosuggest="javascript:getName({cfautosuggestvalue})" autosuggestMinLength=1 autosuggestBindDelay=1> <i>first last <email></i> <cfset ajaxOnLoad("init")> </cfform> </center> </body> </html> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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

