| Page 1 of 1 | [ 3 posts ] |
|
I am currently attempting to set up AutoComplete and it seems that I am having some odd behaviour. What I am trying to do is be able to focus on an AutoComplete field when there are no contents in it and have the container appear with possible results.
It appears that when I click on the text nothing happens, however if I click on the white space to the right of the text, my selection goes through. I have also noticed that this example code only works in Firefox and I need it to also work in IE. Any advice on how to fix this is greatly appreciated. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/fonts/fonts-min.css" /> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/autocomplete/assets/skins/sam/autocomplete.css" /> <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/animation/animation-min.js"></script> <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/datasource/datasource-min.js"></script> <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/autocomplete/autocomplete-min.js"></script> <script type="text/javascript"> var array = [ ["1", "one"], ["2", "two"], ]; function init(){ AC = function() { var oDS = new YAHOO.util.LocalDataSource(array); oDS.resultTypeList = false; var oAC = new YAHOO.widget.AutoComplete("input2", "container2", oDS); oAC.minQueryLength = 0; oAC.textboxFocusEvent.subscribe(function(){ var sInputValue = this._elTextbox.value; if(sInputValue.length === 0) this.sendQuery(sInputValue); }); oAC.resultTypeList = false; oAC.formatResult = function(oResultData, sQuery, sResultMatch) { return (oResultData[0] + " ("+oResultData[1] + ")"); }; return { oDS: oDS, oAC: oAC }; }(); } </script> <style type="text/css"> #myAutoComplete { width:15em; padding-bottom:2em; } </style> </head> <body class="yui-skin-sam" onLoad="init()"> <div id="myAutoComplete"> <input id="Input" type="text"> <div id="Container"></div> </div> <div id="myAutoComplete"> <input id="input2" type="text"> <div id="container2"></div> </div> </body> </html> |
|
It seems I have fixed the problem where it does not work in IE.
oDS.resultTypeList = false; should be: oDS.responseSchema = {fields: ["name", "moreData"]}; and return (oResultData[0] + " ("+oResultData[1] + ")"); should be: return (oResultData.name + " (" + oResultData.moreData + ")"); When testing there seems to be no problems with IE however the problem I listed above still exists in Firefox |
|
Hi Paul,
This seems to be the same issue as tracked in this bug: http://yuilibrary.com/projects/yui2/ticket/2528002 It should be fixed in the latest build and available in the next release. Cheers, Jenny |
| Page 1 of 1 | [ 3 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group