Try resultFormat=”e4x”

On 2/5/10 6:58 AM, "benandbeckyhoffman" <benandbeckyhoff...@yahoo.com> wrote:






I am trying to create a catalog request form and there is an error some where 
because it won't work.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical">

<mx:Style source="css/style.css"/>

<mx:Script>
<![CDATA[
import mx.events.ValidationResultEvent;
import mx.controls.Alert;

private function sendMail():void{
var _senderCompany:String = senderCompany.text;
var _senderName:String = senderName.text;
        var _senderEmail:String = senderEmail.text;
        var _senderAddress:String = senderAddress.text;
        var _senderCity:String = senderCity.text;
        var _senderState:String = senderState.text;
        var _senderZip:String = senderZip.text;

var evValidMail:ValidationResultEvent = mailValidator.validate();
var evValidName:ValidationResultEvent = nameValidator.validate();
var evValidMessage : ValidationResultEvent = mailValidator.validate();

if (evValidMail.type == ValidationResultEvent.VALID
&& evValidName.type == ValidationResultEvent.VALID
&& evValidMessage.type == ValidationResultEvent.VALID){
emailService.send({senderCompany: _senderCompany, senderName: _senderName, 
senderEmail:_senderEmail, senderAddress: _senderAddress, senderCity: 
_senderCity, senderState: _senderState, senderZip: _senderZip});
}
else{
resultLabel.text="There are Form errors";
resultLabel.setStyle("styleName", "invalid");
}
}

private function emailResult():void{
 Alert.show("Thank you for your submission ");
 clearForm();
}

private function clearForm():void{
resultLabel.text="";
senderCompany.text
senderName.text
senderAddress.text="";
senderCity.text="";
senderState.text="";
senderZip.text="";
senderEmail.text="";
senderName.text="";
}


]]>
</mx:Script>
<mx:XMLList id="statesXMLList">
STATE LIST REMOVE TO SAVE SPACE
</mx:XMLList>

<mx:HTTPService id="emailService" url="php/mail.php" method="POST" 
resultFormat="xml" result="emailResult()" useProxy="false"/>
<mx:EmailValidator id="mailValidator"
source="{senderEmail}" property="text"
requiredFieldError="Enter your email" required="true" />
<mx:StringValidator id="nameValidator"
source="{senderName}" property="text"
requiredFieldError="Enter your name" required="true"/>


<mx:Panel height="401" width="400" layout="absolute" title="Request A Catalog">
<mx:Form x="9" y="10" width="360" height="311">
<mx:FormItem label="Company :">
<mx:TextInput id="senderCompany" width="200"/>
</mx:FormItem>
<mx:FormItem label="Name* :">
<mx:TextInput id="senderName" width="200"/>
</mx:FormItem>
<mx:FormItem label="Address* :">
<mx:TextInput id="senderAddress" width="200"/>
</mx:FormItem>
<mx:FormItem label="City* :">
<mx:TextInput id="senderCity" width="200"/>
</mx:FormItem>
<mx:FormItem label="State* :">
<mx:ComboBox id="senderState" prompt="Select a State..." selectedIndex="-1" 
dataProvider="{statesXMLList}" labelField="@label" />
</mx:FormItem>
<mx:FormItem label="Zip* :">
<mx:TextInput id="senderZip" width="200"/>
</mx:FormItem>
<mx:FormItem label="Email* :">
<mx:TextInput id="senderEmail" width="200"/>
</mx:FormItem>
</mx:Form>

<mx:Button label="Send" click="sendMail()" x="136" y="329"/>
<mx:Label id="resultLabel" x="210" y="331"/>
</mx:Panel>

</mx:Application>

AND HERE IS THE PHP CODE

<?php
$senderCompany = $_POST['senderCompany'];
$senderName = $_POST['senderName'];
$senderEmail =  $_POST['senderEmail'];
$senderAddress = $_POST['senderAddress'];
$senderCity = $_POST['senderCity'];
$senderState = $_POST['senderState'];
$senderZip = $_POST['senderZip'];
$sendToEmail = "b...@biacare.com <mailto:ben%40biacare.com> ";
$subject = "BiaCare Catalog Request"


$recipient = "$sendToEmail";

$headers = "From: $senderEmail ";
$message = "From: $senderName, \nCompany: $senderCompany\nName: 
$senderName\nEmail Address: $senderEmail\nAddress: $senderAddress\nCity: 
$senderCity\nState: $senderState\n\nZip: $senderZip";

mail($recipient, $subject, $message, $headers)
?>

Any help will be greatly appreciated.

God Bless!

Ben Hoffman






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to