我在“管理员”面板中的“客户端:”字段的post_form页面上使用它时遇到问题。它适用于我的artist_form客户端,但在我的浏览器的检查器中,它在post_form页面上显示错误。第一个屏幕截图来自post_form,错误,第二个来自artist_form,我有你的好插件工作,第三个我无法发布,因为我没有足够的声誉,因为我是这个网站的新手将来自我的header.php,其中发布了selected.css文件的链接。如果你能协助我解决这个问题,我将不胜感激。
The first screenshot is from the post_form with the error
the second is from the artist_form where I have the plugin working
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>World Music Listing: Master Admin</title>
<link rel="stylesheet" href="public/css/screen.css" type="text/css" media="screen" title="default" />
<link rel="stylesheet" href="public/css/chosen.css">
<!--[if IE]>
<link rel="stylesheet" media="all" type="text/css" href="css/pro_dropline_ie.css" />
<![endif]-->
<!-- jquery core -->
<script src="public/js/jquery/jquery.min.js" type="text/javascript"></script>
<script src="public/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="public/js/chosen.jquery.min.js" type="text/javascript"></script>
</head>
<tr>
<th valign="top">Client:</th>
<td>
<?php
$host_name = "localhost";
$database = "#my database name";
$username = "#my admin user name";
$password = "#my password for the admin user";
//////// Do not Edit below /////////
try {
$dbo = new PDO('mysql:host='.$host_name.';dbname='.$database, $username, $password);
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
// Select all artists (clients) and order by name //
$sql="SELECT aname FROM tbl_music_artists ORDER BY aname";
// multi-select dropdown - select which artists (clients) receive posts //
?>
<select name="userids[]" class="chosen-select" data-placeholder="Choose a Client..." style="width:350px;" multiple>
<?php
foreach ($dbo->query($sql) as $row){
echo "<option value=$row[id]>$row[aname]</option>";
}
?>
</select>
</td>
</tr>
margin
答案 0 :(得分:0)
我能够通过复制并重新粘贴var config = {'。chosen-select':{},'。chosen-select-deselect':{allow_single_deselect:true},'。chosen-来解决我的问题。 select-no-single':{disable_search_threshold:10},'。chosen-select-no-results':{no_results_text:'糟糕,没有找到!'},'。chosen-select-width':{width:“95 %“}} ...我的post_form底部的代码来自所选的jquery。