选择了jQuery,在VBScript / ASP经典和检索的AspUpload多个选择值 [英] Chosen Jquery, retrieving multiple select values in vbscript/classic asp and ASPupload

查看:96
本文介绍了选择了jQuery,在VBScript / ASP经典和检索的AspUpload多个选择值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天早上发布有关选上的jQuery脚本它是如何即时通讯我能够从传统的ASP选定的jQuery多个选择框检索值的问题,有人问我要演示code所以建设时,一切都似乎所有的工作的突然罚款,以为你知道我越来越老,试图执行codeI遇到同样​​的问题,但是之后,但我想我可能已经发现我跑的问题反对。下面你会发现code参与:

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:

这包括2种形式选定的jQuery(http://harvesthq.github.com/chosen/),顶一个是普通的形式,第二个是与上传功能的表单,我已经包括code以下两个页面:

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:

<!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>

====================================================================================================================================================================

====================================================================================================================================================================

<!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>

现在为什么会第一种形式(普通版)给我正确的值回'ChosenData,第二种形式呢?

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.....

推荐答案

您的问题似乎是上传组件只显示选择多个值中的一个。

Your problem seems to be that the upload component is showing only one of the select multiple values.

请参阅Upload.Form只返回一个多的第一个选择项选择控制

作为解决办法显示,你将通过 ChosenData 命名每个表单元素,并显示必须循环。

As the workaround shows, you will have to loop through each form element named ChosenData and display.

这篇关于选择了jQuery,在VBScript / ASP经典和检索的AspUpload多个选择值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆