<select multiple> and enctype = "multipart / form-data"

I wonder if both enctype = "multipart / form-data" and select multiple can be used. Here's an exercise:

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 these options in my list, my action page shows nothing (action.asp):

<%

dim prof

prof = request.form("prof")

response.write prof 

%>     

      

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

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

Thanks in advance.

+3


source to share


2 answers


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



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

0


source


Finally, a bug was found in the FileUploader class. The mcolFormElem Dictionary variable doesn't add name / value pairs if they already exist in the collection for the element <select multiple>

, I added the code below and it worked 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

      

+1


source







All Articles