1 Reply Latest reply on Aug 23, 2009 9:11 PM by adobe_panda

    Adding the send email function on a form.

    ZimmerX
      Hey,
      This has been bugging me lately. I have tried lots of methods to try and get this form to send to a specified email, yet I cannot get my head around it. I tried integrating PHP, it worked...to some extent. Problem was that the application was not defined as a form and the email sent was all screwed up ( no titles and shizzles ). Also, I had to add validators to the form, so I had to start from scratch again.
      Here is the current form code.


      <?xml version="1.0" encoding="utf-8"?>
      <!-- validators\FullApp.mxml -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

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

      private var vResult:ValidationResultEvent;


      private function validateAndSubmit():void {

      vResult = fNameV.validate();
      if (vResult.type==ValidationResultEvent.INVALID)
      return;

      vResult = lNameV.validate();
      if (vResult.type==ValidationResultEvent.INVALID)
      return;


      }
      ]]>
      </mx:Script>


      <mx:Model id="formInfo">
      <formData>
      <name>
      <firstName>{fNameInput.text}</firstName>
      <lastName>{lNameInput.text}</lastName>
      </name>
      <phoneNum>{phoneInput.text}</phoneNum>
      <email>{emailInput.text</email>
      </formData>
      </mx:Model>


      <mx:StringValidator id="fNameV"
      required="true"
      source="{fNameInput}"
      property="text"/>
      <mx:StringValidator id="lNameV"
      required="true"
      source="{lNameInput}"
      property="text"/>
      <mx:PhoneNumberValidator id="pnV"
      source="{phoneInput}"
      property="text"/>
      <mx:EmailValidator id="emV"
      source="{emailInput}"
      property="text"/>




      <mx:Form x="271" y="25">

      <mx:FormItem label="First name">
      <mx:TextInput id="fNameInput"/>
      </mx:FormItem>
      <mx:FormItem label="Last name">
      <mx:TextInput id="lNameInput"/>
      </mx:FormItem>
      <mx:FormItem label="Phone">
      <mx:TextInput id="phoneInput"/>
      </mx:FormItem>
      <mx:FormItem label="Email">
      <mx:TextInput id="emailInput"/>
      </mx:FormItem>
      </mx:Form>

      <mx:Button label="Submit"
      click="validateAndSubmit();" x="373" y="195"/>
      </mx:Application>


      I know I have to add some sort of HTTPService and then connect it to a PHP form sender. But how? I have searched high and low and have yet to find a solid answer with some good code that will work with most forms.

      Thanks a lot.

      Kindest regards,
      David