I have a Flash form that writes to an Access DB using an ASP script. It has 5 text input fields & 1 list box component. The text inputs have the variable assigned via the variable input in the properties panel. The list box component has to have the variable assigned via actionscript. Currently all 5 input text field write to the DB. The list box does not.
I realized that unlike the text inputs I had to set a variable for the list box via actionscript. Initially my list box was not inserting anything. Now it is inserting undefined. The variable name of the list box is OnlineAdTypes. It has an instance name of myListbox.
Here is the AS on my submit button
on(press){
function doSubmit()
{
userData = new LoadVars();
var myListbox = OnlineAdTypes;
userData.Name = Name;
userData.Advertiser = Advertiser;
userData.TypeAd = TypeAd;
userData.When = When;
userData.NonAdCustomOnline
= NonAdCustomOnline;
userData.OnlineAdTypes = OnlineAdTypes.getSelectedI
tems();
userData.send
("processForm.asp",0,"post
");
gotoAndStop(5);
}my script processForm.asp
The processForm.asp script
<%@language = "VBScript" %>
<%
strName = Request.Form("Name")
strAdvertiser = Request.Form("Advertiser")
strTypeAd = Request.Form("TypeAd")
strWhen = Request.Form("When")
strOnlineAdTypes = Request.Form("OnlineAdType
s")
strNonAdCustomOnline = Request.Form("NonAdCustomO
nline")
Set conn = Server.CreateObject("ADODB
.Connectio
n")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"DBQ=\\content\main_data\s
haredDB\on
lineAdCoun
ter.mdb;"
SQL = "INSERT INTO contacts (Name, Advertiser, TypeAd, When, OnlineAdTypes, NonAdCustomOnline) VALUES ('"&strName&"','"&strAdver
tiser&"','
"&strTypeA
d&"','"&st
rWhen&"','
"&strOnlin
eAdTypes&"
','"&strNo
nAdCustomO
nline&"' )"
conn.Execute SQL, recaffected
Response.Write(strName) & "<br>"
Response.Write(strAdvertis
er) & "<br>"
Response.Write(strTypeAd) & "<br>"
Response.Write(strWhen) & "<br>"
Response.Write(strOnlineAd
Types) & "<br>"
Response.Write(strNonAdCus
tomOnline)
& "<BR/><br/>"
Response.Write(recAffected
)
%>
Link to my FLA
http://cincinnati.com/test/artistForm5.fla