4 Replies Latest reply on Jun 7, 2010 8:43 AM by dhifallah

    Can't get back data

    dhifallah

      Hi!

       

      I have a page named Checkout.mxml in witch I have the following form:

       

      <mx:Form>

       

      <mx:FormItem

       

       

      label="Nom" required="true">

       

       

      <mx:TextInput id="cname" width="200"/>

       

       

      </mx:FormItem>

       

       

      <mx:FormItem label="Prénom" required="true">

       

       

      <mx:TextInput id="cname2" width="200"/>

       

       

      </mx:FormItem>

       

       

       

      <mx:FormItem label="Bureau" required="true">

       

       

      <mx:TextInput id="bureau" width="200"/>

       

       

      </mx:FormItem>

       

       

       

      <mx:FormItem label="Lieu" required="true">

       

       

       

      <mx:ComboBox id="lieu" dataProvider="{dpValue}" width="130"/>

       

       

       

      </mx:FormItem>

       

       

       

      <mx:FormItem label="Email" required="true">

       

       

      <mx:TextInput id="email" width="200"/>

       

       

      </mx:FormItem>

       

       

      </mx:Form>

       

       

      In an other code named SendOrder.mxml I have a HTTPSerice witch call a an EmailServelt to send mail with the appropriate data entred in the form,

      here is my SendOrder.mxml:

       

      <mx:TitleWindow

       

      xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" title="Confirmation de votre commande" width="600" height="600">

       

      <mx:Script>

      <![CDATA[

       

      import mx.controls.Alert;

       

      import mx.managers.PopUpManager;

       

       

       

      private function SendMail():void

      {

      HttpSendMail.send();

       

      PopUpManager.removePopUp(

      this);

       

      }

      ]]>

       

      </mx:Script>

       

       

        

       

      <mx:HTTPService id="HttpSendMail"

      url="http://localhost:8080/SupportWEBJ2EE/EmailServlet"

      method="POST" resultFormat="e4x"

      useProxy="false"

       

      showBusyCursor="true">

       

       

       

      <mx:request xmlns="">

       

      <cname>{cname.text}</cname>

       

      <cname2>{cname2.text}</cname2>

       

      <bureau>{bureau.text}</bureau>

       

      <lieu>{lieu.text}</lieu>

       

      <email>{email.text}</email>

       

      <textCommentaire>{textCommentaire.text}</textCommentaire>

       

       

      </mx:request>

       

      </mx:HTTPService>

       

       

      <mx:TextArea id="textTA" width="100%" height="100%" />

       

      <mx:ControlBar>

       

      <mx:Spacer width="50%"/>

       

       

      <mx:Button label="OK" click= "SendMail();" />

       

       

       

      <mx:Spacer width="50%"/>

       

       

      </mx:ControlBar>

      </mx:TitleWindow>

       

       

       

      <mx:request xmlns="">

       

      <cname>{cname.text}</cname>

       

      <cname2>{cname2.text}</cname2>

       

      <bureau>{bureau.text}</bureau>

       

      <lieu>{lieu.text}</lieu>

       

      <email>{email.text}</email>

       

      <textCommentaire>{textCommentaire.text}</textCommentaire>

       

       

      </mx:request>

       

      </mx:HTTPService>

       

       

      <mx:TextArea id="textTA" width="100%" height="100%" />

       

      <mx:ControlBar>

       

      <mx:Spacer width="50%"/>

       

       

      <mx:Button label="OK" click= "SendMail();" />

       

       

       

      <mx:Spacer width="50%"/>

       

       

      </mx:ControlBar>

      </mx:TitleWindow>

       

       

      <mx:request xmlns="">

       

      <cname>{cname.text}</cname>

       

      <cname2>{cname2.text}</cname2>

       

      <bureau>{bureau.text}</bureau>

       

      <lieu>{lieu.text}</lieu>

       

      <email>{email.text}</email>

       

      <textCommentaire>{textCommentaire.text}</textCommentaire>

       

       

      </mx:request>

       

      </mx:HTTPService>

       

       

      <mx:TextArea id="textTA" width="100%" height="100%" />

       

      <mx:ControlBar>

       

      <mx:Spacer width="50%"/>

       

       

      <mx:Button label="OK" click= "SendMail();" />

       

       

       

      <mx:Spacer width="50%"/>

       

       

      </mx:ControlBar>

      </mx:TitleWindow>

       

       

      The probleme is that I can't get back my data entred int the form .Near the block of request there is an error saying that cname,cname2,bureau,lieu,email are not knowen. In my EmailServlet I worked with the followingg method

      String cname = request.getParameter("cname");

      but I have cname: Null as result.

       

      Can you help me please

       

        • 1. Re: Can't get back data
          BhaskerChari Level 4

          Hi,

           

          If you have problem in retrieving the parameters passed from Flex then try the below once and check.

           

          Try to use the GET method instead of POST method for HttpService.


          If this post answers your question or helps, please kindly mark it as such.


          Thanks,

          Bhasker Chari

          • 2. Re: Can't get back data
            dhifallah Level 1

            Thank you for the reply

            I Tried the GET method insted of POST , but I have always the same problem !!

            • 3. Re: Can't get back data
              dhifallah Level 1

              I tried to create the same FormItem in the same page where I call a

              HTTPService, and here the problemm is resolved : I get back the data entred in each FormItem.

              So to resolve my problem , I have to call the code wichh contain the Form , but I don't know how to call Checkout.mxml in SendOrder.mxml?????

              • 4. How can I make a link between two codes mxml
                dhifallah Level 1

                I have an HTTPService with a request in aa.mxml and in an other bb.mxml I have a Form witch contain many FormItem.

                I have to make a link between them because when i write my request like this I have an errror:

                <mx:request

                 

                 

                xmlns="">

                <cname>{cname.text}

                </cname>

                 

                <cname2>{cname2.text}</cname2>

                 

                <bureau>{bureau.text}</bureau>

                 

                <lieu>{lieu.text}</lieu>

                 

                <email>{email.text}</email>

                 

                <textCommentaire>{textCommentaire.text}</textCommentaire>

                 

                 

                </mx:request>