Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Select list box

Status
Not open for further replies.

jlong07

Technical User
Nov 8, 2002
56
US
I have a cms system for a web site that uses asp and a database. Thereis an add record page and an update record page that both have a list box that allows multiple selections. I used the funtions for inserting and updating records in a database that are built in to Dreamweaver MX 2004 (I think they are the same in MX). This work fine. However, I needed to give the user the ability to upload a picture and then have the path and name of the picture placed in a field on the database as well. I found an asp upload extension on Macromedia's site that was developed by a guy named Revello Gianluigi. This extension was recommended by Macromedia and said that it used the built in funtions for inserting and updating records but just added the ability to upload files. I used this extension and it worked great but for one thing. Now when I have multiple items selected in the list box it only uploads the first item. This is very bad because the user has to be able to select multiple values. I am not an asp programmer and thus do not really understand the code that the extension created. I need to find a way to modify it though to allow for the multiple selections to be passed as comma seperated values into the database. I have the same problem whether I am using the add or update page. Here is the script that the extension created. The server language is asp vb.

'*****************************************
'* *
'* INSERT RECORD AND UPLOAD *
'* if remove this comment Dreamveaver *
'* don't recognize the behaviors *
'* *
'*****************************************


server.ScriptTimeout = 5400

Dim RG_altVal, RG_columns, RG_Cong, RG_dbValues, RG_dbValuesTmp, RG_delim, RG_editCmd, RG_editQuery, RG_editQueryTmp, RG_emptyVal, RG_Ext, RG_Extensions, RG_fields, RG_FieldValueTmp, RG_FileDel, RG_FileExt, RG_formVal, RG_FS, RG_i, RG_L, RG_Len, RG_Max, RG_Name, RG_New, RG_newName, RG_Num, RG_Path, RG_Rec, RG_ret, RG_Save, RG_tableValues, RG_tableValuesTmp, RG_tst, RG_typeArray, RG_z, UploadStatus, NumFile
Dim RG_Connection, RG_editColumn, RG_recordId, Form, editAction, editRedirectUrl, RG_Files, RG_formName, UploadType, ParamVal, ParamList, MaxFieldNumber, TmpVal, x, y, Key, ProgressBar
Dim tmpField_Name(), tmpValue_Name(), tmpField_Size(), tmpValue_Size(), QtyRecord

Set Form = New ASPForm
Dim UploadID
UploadID = Form.NewUploadID
ProgressBar = "progress-std.asp"
editRedirectUrl = "/admin.asp"
RG_Connection = MM_conn_mckibben_STRING
RG_editTable = "tblPropertyInfo"
RG_Files = "/images/listings/;1;;;;1;PictureURL;1;;;;0;;;flPictureURL|/images/listings/;1;;;;1;SitePlanURL;1;;;;0;;;flSitePlanURL@_@_@1"
RG_formName = "frmAddListing"
UploadType="Insert"
UploadStatus = ""
NumFile = 0

if len(Request.QueryString("UploadID"))>0 then
Form.UploadID = Request.QueryString("UploadID")
end if

if (Request.QueryString <> &quot;&quot;) Then
editAction = CStr(Request.ServerVariables(&quot;SCRIPT_NAME&quot;)) & &quot;?&quot; & Request.QueryString & &quot;&UploadID=&quot; & UploadID
else
editAction = CStr(Request.ServerVariables(&quot;SCRIPT_NAME&quot;)) & &quot;?UploadID=&quot; & UploadID
End If

Const fsCompletted = 0

If Form.State = fsCompletted Then
if Form.State = 0 then

Set ParamVal = CreateObject(&quot;Scripting.Dictionary&quot;)
tmp = split(RG_Files,&quot;@_@_@&quot;)
ParamList = split(tmp(0),&quot;|&quot;)
MaxFieldNumber = ubound(ParamList)
for x=0 to Ubound(ParamList)
TmpVal = Split(ParamList(x),&quot;;&quot;)
for y=0 to ubound(TmpVal)
Key = cstr(x) & cstr(y)
ParamVal.add Key, TmpVal(y)
next
next
Form.Files.Save

RG_fieldsStr = &quot;txtAddress|value|txtCity|value|txtSqFt|value|txtPrice|value|txtType|value|txtAgent|value|lstCategory|value|txtForLeaseSale|value|txtBuildingName|value|txtHeading|value|txtPictureCaption|value|txtPricingDesc|value|txtBullet1|value|txtBullet2|value|txtRemarks|value&quot;
RG_columnsStr = &quot;Address|',none,''|City|',none,''|SqFt|',none,''|Price|',none,''|Type|',none,''|Agent|',none,''|Category|',none,''|LeaseSale|',none,''|BuildingName|',none,''|Heading|',none,''|PictureCaption|',none,''|PricingDesc|',none,''|BulletList1|',none,''|BulletList2|',none,''|Remarks|',none,''&quot;
Form.Files.DataBaseInsert

response.write(getRedirect())
response.end
End If
ElseIf Form.State > 10 then
response.write &quot;<br><Font Color=red>Some form error.</Font><br>&quot;
End If


function GetFolderName(str): GetFolderName = Ris : end function

function myGetFileName(str): myGetFileName = Ris : end function
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top