Avatar of rarid1224
rarid1224

asked on 

Sending Email Form Variables to ASP server in AS3 w/ Combo Boxes, Text Fields and Check Boxes

I want to send form information to an ASP server using ActionScript 3. My fields are text boxes, check boxes, and drop down menus for birthday, date and year. I am not sure of the syntax for getting the data from the components and sending them to the server. Can you review my code and alert me of errors?

the combo box instance names are birthMonth, birthDay, and birthYear

the check box instance names are gender1, gender2, interestedYes, interestedNo, contactedYes, contactedNo
stop();
 
var address1:String = "http://borregoservername/";
var url:URLRequest;
var variables:URLVariables = new URLVariables();
variables.subject = "Information sent from Borrego Flash Form"
variables.recipient = "you@yourdomain.com";
 
submit_btn2.addEventListener(MouseEvent.CLICK, submitInfo);
submit_btn2.buttonMode = true;
 
function submitInfo(Event:MouseEvent):void
{
	variables.firstname = firstName.text;
	variables.lastname = lastName.text;
	variables.address = address.text;
	variables.apt = apt.text;
	variables.email = email.text;
	variables.city = city.text;
	variables.state = state.text;
	variables.zip = zip.text;
	variables.phone = phone.text;
	variables.birthMonth = birthMonth.text;
	variables.birthDay = birthDay.text;
	variables.birthYear = birthYear.text;
	variables.male = gender1.selected;
	variables.female = gender2.selected;
	variables.acquire = acquire.text;
	variables.interestedYes = interestedYes.selected;
	variables.interestedNo = interestedNo.selected;
	variables.dealerContactYes = contactedYes.selected;
	variables.dealerContactYes = contactedNo.selected;
	
	url = new URLRequest(address1);
	url.method = URLRequestMethod.POST;
	url.data = variables;
	navigateToURL(url);
	gotoAndStop("process");
}
 
interestedYes.selected;
 
 
if(interestedYes.selected)
	{
	interestedNo.selected = false;
	}
	else(interestedNo.selected)
	{
	interestedYes.selected = false;
	}
	
interestedYes.addEventListener(MouseEvent.CLICK, checkbox);
interestedNo.addEventListener(MouseEvent.CLICK, checkbox2);
 
	
function checkbox (event:MouseEvent):void
{
	interestedYes.selected = true;
	interestedNo.selected = false;
}
 
function checkbox2 (event:MouseEvent):void
{
	interestedYes.selected = false;
	interestedNo.selected = true;
}
 
 
contactedYes.addEventListener(MouseEvent.CLICK, contact);
contactedNo.addEventListener(MouseEvent.CLICK, contact2);
 
	
function contact (event:MouseEvent):void
{
	contactedYes.selected = true;
	contactedNo.selected = false;
}
 
function contact2 (event:MouseEvent):void
{
	contactedYes.selected = false;
	contactedNo.selected = true;
}

Open in new window

form.png
Adobe FlashApache Flex

Avatar of undefined
Last Comment
TomasoB

8/22/2022 - Mon