0 Replies Latest reply on Oct 1, 2008 7:40 AM by JmfD

    Data Binding error with PHP form

    JmfD
      I'm trying to create a email form that will pull down the send to email address from a database to a tile repeater list of checkboxes, were you could choose who you want to send an email to. I keep getting a databinding warning for the emailTo code. However when I change my php code to send to a static address it works. Any ideas?

      MXML code:
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      initialize="doSend()"
      layout="absolute" xmlns:events="flash.events.*">

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

      private function sendInfo():void{
      if(user.text=="" || email.text=="" || message.text==""){
      mx.controls.Alert.show("Sorry, information appears to be missing!")
      } else {
      srv.send()
      }
      }

      private function thanks(event:Event):void{
      mx.controls.Alert.show("Thanks! Your message has been sent.")
      }

      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;

      [Bindable]
      private var datalist:ArrayCollection;

      private function resultHandler(event:ResultEvent):void{
      datalist = event.result.data.row;
      }
      public function doSend():void {
      xmlFromDatabase.url = " http://localhost/xml.php";
      xmlFromDatabase.send();
      }
      ]]>
      </mx:Script>
      <mx:HTTPService id="srv" url=" http://localhost/mail.php" method="POST" contentType="application/x-www-form-urlencoded" resultFormat="text" result="thanks(event)">
      <mx:request>
      <emailTo>{emailTo.text}</emailTo>
      <user>{user.text}</user>
      <email>{email.text}</email>
      <message>{message.text}</message>
      </mx:request>
      </mx:HTTPService>

      <mx:HTTPService url=" http://localhost/xml.php"
      id="xmlFromDatabase"
      showBusyCursor="true"
      result="resultHandler(event)"
      method="GET" />
      <mx:Form x="430" y="10">
      <mx:FormItem label="Sent To">
      <mx:Tile x="10" y="425" width="250">
      <mx:Repeater id="dataRepeater" dataProvider="{datalist}">
      <mx:CheckBox x="10" y="434" id="emailTo" label="{dataRepeater.currentItem.username}" />
      </mx:Repeater>
      </mx:Tile>
      </mx:FormItem>
      <mx:FormItem label="Name">
      <mx:TextInput id="user"/>
      </mx:FormItem>
      <mx:FormItem label="Email">
      <mx:TextInput id="email"/>
      </mx:FormItem>
      <mx:FormItem label="Message">
      <mx:TextArea width="211" height="117" id="message" />
      </mx:FormItem>
      <mx:FormItem>
      <mx:Button label="Submit" click="srv.send()"/>
      </mx:FormItem>
      </mx:Form>