3

フォームのコンパイル中に、すでに使用されている値のリストを表示して、値を挿入できる必要があります(通常のリストボックスの動作)。ただし、新しい値を入力できる必要があるため、aui:autocomplete(以下のコード)を選択しました。

デフォルトでは、「delimChar」セパレータで区切られた複数のアイテムを選択できます。単一の値の選択(または新しい値)を1つに制限する方法はありますか?

var catArray = new Array();
    <%for (String s : categoryList) {%>
        catArray.push('<%=s%>');
    <%} %>
    var autoCompleteCategory = new A.AutoComplete( 
    { 
        contentBox: '#<portlet:namespace />contactOptions',
        input:'#<portlet:namespace/>category',
        dataSource: catArray, 
        delimChar: ',', 
        typeAhead: true, 
    }).render();
4

1 に答える 1

1

可視性を高めるための答えとしてコメントを作成する:

delimchar: ','次のコードから属性を削除できます。

var catArray = new Array();
    <%for (String s : categoryList) {%>
        catArray.push('<%=s%>');
    <%} %>
    var autoCompleteCategory = new A.AutoComplete( 
    { 
        contentBox: '#<portlet:namespace />contactOptions',
        input:'#<portlet:namespace/>category',
        dataSource: catArray, 
        delimChar: ',', // **remove this attribute**
        typeAhead: true, 
    }).render();

これでうまくいくと思います。

また、試す前にブラウザのキャッシュをクリアしてください:)

于 2012-09-28T04:34:18.323 に答える