问题
I am using Chosen for jQuery and the folder field is returning null, however when I look at the source of the page, the values are given. I can't figure out what I am doing wrong, my code is below:
For The HTML:
<!doctype html>
<html><head>
<meta name="viewport" content="width = 1300">
<meta charset="UTF-8">
<title>Back Office | Home</title>
<link rel="stylesheet" type="text/css" href="../Style Sheets/styles.css"/>
<link rel="stylesheet" type="text/css" href="../chosen/chosen.css">
<script src="../chosen/jquery.js"></script>
<script src="../chosen/chosen.jquery.js"></script>
<script>
jQuery(document).ready(function(){
jQuery(".folderselector").chosen();
jQuery(".chosenyesno").chosen({disable_search_threshold: 3});
});
</script>
<link rel="stylesheet" type="text/css" href="../jquery-ui-1.9.1/themes/base/jquery-ui-1.9.1.custom.css">
<script src="../js/jquery-ui-1.9.1.custom.js"></script>
<link rel="stylesheet" type="text/css" href="../jquery-ui-1.9.1/themes/base/jquery.ui.all.css">
<script>
$(function() {
$( document ).tooltip();
});
</script>
<link class="theme-css" href="../Style Sheets/headermenu.css" rel="stylesheet">
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
</style>
<script src="../Scripts/instantiatemenu.js"></script>
</head>
<body>
<div align="center">
<div class="wrapper">
<div class="welcome">
<div class="user-panel header-divider">
<div class="user-info">
<nobr>
<a href="#" style="padding-right: 8px;">Alex Cross</a>
</nobr>
</div>
<div class="user-dropbox">
<ul>
<li class="procaptureli"><a href="/Members/profile.php">PROCapture Home</a></li>
<li onclick="location.href='/BackOffice/Home.php?doLogout=true';" class="logout"><a href="/BackOffice/Home.php?doLogout=true">Logout</a></li>
</ul>
</div>
</div><!-- User panel end -->
<script type="text/javascript" src="../Scripts/header.js"></script>
</div>
<div class="header">
</div>
<!--end header-->
<div class="content_wrapper">
<div class="main_content">
<div class="sidebar">
<div class="sidebar_main">
<div class="menu_holder">
<h1>Control Panel</h1>
<ul class="menu_items">
<li class="menu-1"><a href="Home.php">Home</a></li>
<li class="menu-2"><a href="Manage Leads.php" class="current">Manage Leads</a></li>
<li class="menu-3"><a href="Manage Autoresponses.php">Manage Autoresponses</a></li>
<li class="menu-4"><a href="My NMVT.php">My NMVT</a></li>
<li class="menu-5"><a href="Home.php">Lead Capture Settings</a></li>
<li class="menu-6"><a href="Upcoming Appointments.php">Appointments</a></li>
<li class="menu-7"><a href="Home.php">Resources</a></li>
<li class="menu-8"><a href="Home.php">Referral System</a></li>
<li class="menu-9"><a href="Home.php">My Account</a></li>
<li class="menu-10"><a href="Contact Support.php">Contact Support</a></li>
</ul>
</div>
</div>
</div>
<!--end sidebar-->
<div class="content">
<div class="content_container">
<div class="page_container">
<div class="content_page_header_2">
<span>New Lead</span>
</div>
<form method="POST" action="/BackOffice/New Lead.php?" class="formid1" name="form">
<input name="username_field" type="hidden" value="homesuccessgroup">
<div class="box_container">
<div class="View_Edit_Lead_LongBox Boxes">
<div class="View_Lead_Header">
<input title="Input The Full Name Of The Lead." onFocus="if(this.value=='Full Name')this.value='';" onblur="if(this.value == ''){ this.value = 'Full Name';}" name="Lead_Name" type="text" class="FullNameInput" value="Full Name" size="25">
</div>
<div class="View_Lead_Info_Side">
<span>Info</span>
<div class="BlueBox Medium_BlueBox_2">
<div class="wrapper_text_1">
<p class="paragraph_1">Phone: <input title="Input The Phone Number Of The Lead." onFocus="if(this.value=='Phone Number')this.value='';" onblur="if(this.value == ''){ this.value = 'Phone Number';}" name="Phone_Field" type="text" value="Phone Number"> <br/> Email: <input title="Input The Email Of The Lead." onFocus="if(this.value=='Email')this.value='';" onblur="if(this.value == ''){ this.value = 'Email';}" name="Email_Field" type="text" value="Email"></p>
</div>
</div>
<div class="BlueBox Small_BlueBox">
<p class="paragraph_2">Have You Contacted This Lead? <select class="chosenyesno" name="contacted_field">
<option value="Yes">Yes</option>
<option value="No" selected="selected">No</option>
</select>
</p>
</div>
<div class="BlueBox Small_BlueBox">
<p class="paragraph_2">
Put Lead In Folder: <select class="folderselector" name="selectleads">
<option value="Alexs Folder">Alexs Folder</option>
<option value="Aweber Imports">Aweber Imports</option>
<option value="Cold Leads">Cold Leads</option>
<option value="Contacted">Contacted</option>
<option value="Contacted Once">Contacted Once</option>
<option value="Contacted Twice">Contacted Twice</option>
<option value="Family Guy">Family Guy</option>
<option value="GVO Imports">GVO Imports</option>
<option value="Hot Leads">Hot Leads</option>
<option value="MCA Imports">MCA Imports</option>
<option value="New Leads">New Leads</option>
<option value="Not Contacted">Not Contacted</option>
<option value="UPP Leads">UPP Leads</option>
<option value="Visited">Visited</option>
</select></p>
</div>
<div class="shorter_blue_box FooterBox">
<p>This Lead Came From: <select>Big select box... etc.</select></p>
</div>
</div>
<div class="View_Lead_Notes_Side">
<span>Notes</span>
<div class="BlueBox Large_BlueBox">
<div class="notes_wrapper_2">
<textarea title="Input Any Notes You Have For The Lead(Optional)" name="Notes_Field" cols="" rows="" class="notes_field_1"></textarea>
</div>
</div>
</div>
</div>
<div class="Manage_Leads_ShortBox_1 Boxes">
<span>Create New Lead?</span>
<div class="button_container_1">
<div onClick="location.href='View Folder.php?Folder=';" class="no_button SpritesPage2">
</div>
<input name="submit_button" type="submit" class="yes_button SpritesPage2" value=" ">
</div>
</div>
</div>
<div class="content_page_footer">
</div>
<input type="hidden" name="MM_insert" value="form">
</form>
</div>
</div>
<!--end content_container-->
</div>
<!--end content-->
</div>
<!--end main_content-->
</div>
<!--end content_wrapper-->
</div>
<!--end wrapper-->
<div class="footer">
<div class="text_wrapper">
<p>Copyright © 2012 PROCapture LLC</p>
<p>Privacy Policy | Terms And Conditions</p>
</div>
</div>
</div>
</body>
</html>
Heres The Form Action:
$currenttime = time();
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if($_POST['Notes_Field'] != "") {
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {
if (strpos($_POST['Lead_Name'], "'") === false) {
if (strpos($_POST['Lead_Name'], '"') === false) {
if (strpos($_POST['Lead_Name'], '#') === false) {
$insertSQL = sprintf("INSERT INTO Leads (FullName, Email, PhoneNumber, Country, Folder, Notes, `User`, TimeAdded, Contacted) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Lead_Name'], "text"),
GetSQLValueString($_POST['Email_Field'], "text"),
GetSQLValueString($_POST['Phone_Field'], "text"),
GetSQLValueString($_POST['Country_Field'], "text"),
GetSQLValueString($_POST['Folder'], "text"),
GetSQLValueString($_POST['Notes_Field'], "text"),
GetSQLValueString($_POST['username_field'], "text"),
GetSQLValueString($currenttime, "int"),
GetSQLValueString($_POST['contacted_field'], "text"));
mysql_select_db($database_myBackOfficeConn, $myBackOfficeConn);
$Result1 = mysql_query($insertSQL, $myBackOfficeConn) or die(mysql_error());
$insertGoTo = "View Folder.php?Folder=" . $_POST['Folder'] . "";
header(sprintf("Location: %s", $insertGoTo));
}
else{
header(sprintf("Location: %s", "Error102.php"));
}
}
else{
header(sprintf("Location: %s", "Error102.php"));
}
}
else {
header(sprintf("Location: %s", "Error102.php"));
}
}
}
else {
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {
if (strpos($_POST['Lead_Name'], "'") === false) {
if (strpos($_POST['Lead_Name'], '"') === false) {
if (strpos($_POST['Lead_Name'], '#') === false) {
$insertSQL = sprintf("INSERT INTO Leads (FullName, Email, PhoneNumber, Country, Folder, `User`, TimeAdded, Contacted) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Lead_Name'], "text"),
GetSQLValueString($_POST['Email_Field'], "text"),
GetSQLValueString($_POST['Phone_Field'], "text"),
GetSQLValueString($_POST['Country_Field'], "text"),
GetSQLValueString($_POST['Folder'], "text"),
GetSQLValueString($_POST['username_field'], "text"),
GetSQLValueString($currenttime, "int"),
GetSQLValueString($_POST['contacted_field'], "text"));
mysql_select_db($database_myBackOfficeConn, $myBackOfficeConn);
$Result1 = mysql_query($insertSQL, $myBackOfficeConn) or die(mysql_error());
$insertGoTo = "View Folder.php?Folder=" . $_POST['Folder'] . "";
header(sprintf("Location: %s", $insertGoTo));
}
else{
header(sprintf("Location: %s", "Error102.php"));
}
}
else{
header(sprintf("Location: %s", "Error102.php"));
}
}
else {
header(sprintf("Location: %s", "Error102.php"));
}
}
}
来源:https://stackoverflow.com/questions/13349796/chosen-jquery-plugin-is-returning-null