Reputation: 329
I have been messing with this widget (http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/basic.htm) for a few hours now with no progress. I need the dropdown to function like the second example on the above link. As of right now the dropdown opens and when I go to click on a checkbox it automatically closes. I can access the fields of the dropdown with the keyboard and by pressing enter it will select the desired option. But, when I go to mouse click on the option the entire dropdown hides itself. Also, the dropdown falls behind the rest of the contact form below it. I tried z-index with no luck. Thank you guys in advance this is driving me crazy. Below is my code:
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>#attributes.title#</title>
<META NAME="TITLE" CONTENT="#attributes.title#"/>
<META NAME="keywords" content="#attributes.keywords#" />
<META NAME="description" content="#attributes.description#" />
<script type="text/javascript" src="../ddcl/jquery-1.6.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="/jQuery/Fancy/style.css" />
<link rel="stylesheet" type="text/css" href="/jQuery/Fancy/jquery.fancybox-1.3.1.css">
<link rel="stylesheet" href="/Themes/PrintCenter/style.css" />
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script type="text/javascript" src="../ddcl/jquery.multiselect.js"></script>
<cfinclude template="/Includes/header_head.cfm">
</head>
And the HTML
<cfform action="/Task/Form/ProcessForm.cfm" id="print-request-form" method="post" name="printrequestform">
<span>Select Print Material</span>
<select name="example-optgroup" multiple="multiple" size="5" id="dropdowns">
<optgroup label="Tri-Fold Brochure">
<option value="option1">500 units</option>
<option value="option2">1000 units</option>
<option value="option3">1500 units</option>
</optgroup>
<optgroup label="Group Two">
<option value="option4">500 units</option>
<option value="option5">1000 units</option>
<option value="option6">1500 units</option>
<option value="option7">2000 units</option>
</optgroup>
</select><label><span>Full Name:</span> <cfinput class="input-text" maxlength="100" message="Please enter a valid name." name="name" required="yes" size="30" type="text" validate="maxlength"></cfinput></label></cfform>
The script
<script type="text/javascript">
$("#dropdowns").multiselect({
selectedList: 2 // 0-based index
});</script>
Upvotes: 0
Views: 8686
Reputation: 11
Check your element name, when say it multiple, it must be a array.
<select name="my_options[]" multiple class="multiselect">
Upvotes: 0
Reputation: 4399
Try the code below. I have created an example Fiddle for you to see it in action.
Quite a lot of your page html code is not connected directly to the problem of rendering the Grouped order of the Multiselect JQuery selector, so I have left it out of the code below:
<script type="text/javascript">
$(function(){
$("select").multiselect();
});
</script>
<cfform action="/Task/Form/ProcessForm.cfm" id="print-request-form" method="post" name="printrequestform">
<h1>Optgroups Example</h1>
<h3>ehynds / jquery-ui-multiselect-widget</h3>
<span>Select Print Material</span>
<select name="example-optgroup" multiple="multiple" size="5" id="dropdowns">
<optgroup label="Tri-Fold Brochure">
<option value="option1">500 units</option>
<option value="option2">1000 units</option>
<option value="option3">1500 units</option>
</optgroup>
<optgroup label="Group Two">
<option value="option4">500 units</option>
<option value="option5">1000 units</option>
<option value="option6">1500 units</option>
<option value="option7">2000 units</option>
</optgroup>
</select><label><span>Full Name:</span> <cfinput class="input-text" maxlength="100" message="Please enter a valid name." name="name" required="yes" size="30" type="text" validate="maxlength"></cfinput></label></cfform>
I hope that this helps with your problem and anybody else who has a similar issue.
Upvotes: 0