나는 YUI에서 자동 완료 기능을 구현했습니다. 하지만 사용자가 제안을 선택할 때, 양식이 제안YUI 자동 제출 제안 제출
<script>
YUI().use('array-extras','autocomplete','autocomplete-highlighters',function(Y) {
function locateModules(response) {
var results = [];
if(response && response.dimensions){
for (var i = 0; i < response.dimensions.length; i++) {
if(response.dimensions[i] && response.dimensions[i].refinements){
for (var j = 0; j < response.dimensions[i].refinements.length; j++) {
if(response.dimensions[i].refinements[j].refinements){
results = results.concat(response.dimensions[i].refinements[j].refinements)
}
results.push(response.dimensions[i].refinements[j]);
}
}
}
}
return Y.Array.filter(results, function(result) {
//some other conditions
return true;
});
}
Y.one('#searchId').plug(Y.Plugin.AutoComplete, {
resultHighlighter : 'phraseMatch',
resultListLocator : locateModules,
resultTextLocator : 'name',
source : '<%=autoCompleteURL%>&<portlet:namespace/>q={query}'
});
});
</script>
와 함께 제출해야 할 일은 싶습니다 나는이
<form ...>
<input name="searchId" id="searchId" placeholder="Search Product" />
......
</form>
- 자동 - 같은 양식을 가지고있는 제안이 제대로 이루어지고 있습니다. 사용자가 제안을 선택할 때
아래와 같이, 그것은 실제로 어떤 사용자가 입력됩니다에 관한 제안을 얻는다 다른 자동 제안 상자가있다 형태
Orange color
텍스트/카테고리는 어떻게 그림과 같이 표시합니까? <html>
<body class="yui3-skin-sam">
<div class="line">
<div id="invoice-customer-id">
<input type="text" value="x"/>
</div>
</div>
</body>
</html>
자바 스크립트
[This (http://stackoverflow.com/questions/4713987/yui-autocomplete-events-how-to)가 도움이 될 것입니다. 설명서에 따르면 사용자가 제안을 선택하면 "선택"이벤트가 시작됩니다. –
@sivatumma, 정말 제안을 선택하는 데 양식을 제출하는 데 도움이 감사합니다. 그러나 내 게시물 당 검색 제안을 어떻게 표시합니까? – Reddy