<select multiple> and enctype="multipart/form

I wonder if it is possible to use both enctype="multipart/form-data" and a select multiple. Here is the drill:

I have this html file (test.html):

<form action="action.asp" method="post" enctype="multipart/form-data" name="form1">

    <select multiple name="prof">

        <option value="1">First</option>
        <option value="2">Second</option>
        <option value="3">Third</option>

    </select>

    <input type="submit" value="Ok" name="Ok">  

</form>

When I select any of those options on my list, my action page doesn't show anything (action.asp):

<%

dim prof

prof = request.form("prof")

response.write prof 

%>     

But if I remove the enctype="multipart/form-data" in test.html, then it works.

The problem is that I am using an asp upload file component that requires this enctype="multipart/form-data". Any sugestions?

Thanks in advance.


if your using enctype="multipart/form-data" it must be because you are uploading a file. if you upload a file you should be using a upload component if you do you could use :

Set yourUploadComponent = CreateObject("Your.UploadComponentClassString")
sFormValue =yourUploadComponent.Form.Item("prof").Value


Finally found a bug on FileUploader class. The mcolFormElem Dictionary variable does not add the name/value pairs if already exist on the collection for the <select multiple> element, I have added the below code and working fine.

If Not mcolFormElem.Exists(LCase(sInputName)) Then 
                mcolFormElem.Add LCase(sInputName), CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
            else
                dim tempKeyVal
                tempKeyVal=mcolFormElem.item(LCase(sInputName))
                mcolFormElem.Remove(LCase(sInputName))
                mcolFormElem.Add LCase(sInputName), tempKeyVal&","&CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
            end if
链接地址: http://www.djcxy.com/p/22202.html

上一篇: 数据“不支持发送简单文本?

下一篇: <select multiple>和enctype =“multipart / form