yii で選択された javascript ( http://harvesthq.github.com/chosen/ ) プラグインを使用して、ドロップダウン リストから複数の入力を取得しています。このコードを使用しています:-
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="chosen/chosen.css" />
</head>
<body>
<h2>Multiple Select</h2>
<div>
<div>
<select data-placeholder="Choose a Country..." class="chzn-select" multiple style="width:350px;" tabindex="4">
<option value=""></option>
<option value="United States">United States</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afghanistan">Afghanistan</option>
</select>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script>
<script src="chosen/chosen.proto.js" type="text/javascript"></script>
<script type="text/javascript">
document.observe('dom:loaded', function(evt) {
var select, selects, _i, _len, _results;
if (Prototype.Browser.IE && (Prototype.BrowserFeatures['Version'] === 6 || Prototype.BrowserFeatures['Version'] === 7)) {
return;
}
selects = $$(".chzn-select");
_results = [];
for (_i = 0, _len = selects.length; _i < _len; _i++) {
select = selects[_i];
_results.push(new Chosen(select));
}
deselects = $$(".chzn-select-deselect");
for (_i = 0, _len = deselects.length; _i < _len; _i++) {
select = deselects[_i];
_results.push(new Chosen(select,{allow_single_deselect:true}));
}
return _results;
});
</script>
</body>
</html>
選択されたという名前の別のフォルダーにリソースchosen.jquery.js、chosen.jquery.min.js、chosen.proto.js、chosen.proto.min.jsを含む単純なプロジェクトとして実行すると、うまく機能します。しかし、yii プロジェクトで同じように実装すると、機能しません。プラグインを Yii で動作させるために必要な追加のコード フラグメントはありますか?