this morning I posted a question regarding the Chosen jQuery script which was how im i able to retrieve the values from a chosen jquery multiple select box with classic asp, someone asked me for demo code so when building it, everything seems to work all of the sudden fine, and thought you know i'm getting to old, however after trying to implement the code i ran into the same issues, but I think i might have found the problem that i'm running against. Below you will find the code involved:
This includes 2 forms of the chosen jquery (http://harvesthq.github.com/chosen/), the top one is a plain form, the second one is a form with upload function, i have included the code below of both pages:
Code for 'example.jquery.html'
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="chosen/chosen.css" />
</head>
<body>
<h3>Chosen without enctype="multipart/form-data"</h3>
<form action="CollectChosenData.asp?type=plain" method="post" name="ExampleChosen">
<div id="container">
Multiple Select<br><br>
<select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chzn-select" name="ChosenData" tabindex="8">
<option value=""></option>
<option value="1">American Black Bear</option>
<option value="2">Asiatic Black Bear</option>
<option value="3">Brown Bear</option>
<option value="4">Giant Panda</option>
<option value="5" selected>Sloth Bear</option>
<option value="6">Sun Bear</option>
<option value="7" selected>Polar Bear</option>
<option value="8">Spectacled Bear</option>
</select>
<br>
<br>
text field:
<input type="text" name="othertext" value="text value">
<br>
<br>
<input type="submit" name="ExampleChosenSubmit" value="Post form">
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="chosen/chosen.jquery.js" type="text/javascript"></script>
<script type="text/javascript"> $(".chzn-select").chosen();</script>
</form>
<br>
<hr>
<br>
<h3>Chosen with enctype="multipart/form-data"</h3>
<form action="CollectChosenData.asp?type=upload" method="post" name="ExampleChosenUpload" enctype="multipart/form-data">
<div id="container">
Multiple Select<br><br>
<select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chzn-select" name="ChosenData" tabindex="8">
<option value=""></option>
<option value="1">American Black Bear</option>
<option value="2">Asiatic Black Bear</option>
<option value="3">Brown Bear</option>
<option value="4">Giant Panda</option>
<option value="5" selected>Sloth Bear</option>
<option value="6">Sun Bear</option>
<option value="7" selected>Polar Bear</option>
<option value="8">Spectacled Bear</option>
</select>
<br>
<br>
other field:
<input type="file" name="mytestfile" value="">
<br>
<br>
text field:
<input type="text" name="othertext" value="text value">
<br>
<br>
<input type="submit" name="ExampleChosenSubmit" value="Post form">
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="chosen/chosen.jquery.js" type="text/javascript"></script>
<script type="text/javascript"> $(".chzn-select").chosen();</script>
</form>
</body>
</html>
====================================================================================================================================================================
code for 'CollectChosenData.asp'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
If Request.Querystring("type") = "plain" Then
Response.write "Value collected from chosen select box: '"& Request.Form("ChosenData") &"'<br/>"
Response.write "Value collected from text field: '"& Request.Form("othertext") &"'<br/>"
ELseIf Request.Querystring("type") = "upload" Then
Set objUpload = Server.CreateObject("Persits.Upload")
objUpload.OverwriteFiles = False
objUpload.SetMaxSize 1048576 ' Limit files to 1MB
objUpload.SaveVirtual "/upload"
Response.write "Value collected from chosen select box: '"& objUpload.Form("ChosenData") &"'<br/>"
For Each File in objUpload.Files
Response.write File.FileName &"<br/>"
Next
Response.write "Value collected from text field: '"& objUpload.Form("othertext") &"'<br/>"
Set objUpload = nothing
End if
%>
<br>
<br>
Return and <a href="example.jquery.html">try again</a>
</body>
</html>
Now why would the first form (plain version) give me the correct values back for ' ChosenData' and the second form not ?
So many thanks for your help and replies guys, he says while scratching his head.....