4 Replies Latest reply on Dec 7, 2009 3:11 PM by PakoCancun

    Contact Form

    PakoCancun

      Hi

       

      I'm making a web page and I wanna include a contact form in it so I'm making it in FLASH CS4

      Using Action Sript 3.0.

      I watched some video tutorials in YouTube in how to make the Code and PHP form.

      But when I finished the form on flash I published it in SWF and

      when I click the submit button this error shows on the OUTPUT tab:

       

       

           Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.

           at Error$/throwError()

           at flash.net::URLVariables/decode()

           at flash.net::URLVariables()

           at flash.net::URLLoader/onComplete()

       

       

       

      I don't know if there is an error on my code, because I upleaded it into the web to try it and I didn't recive anything

      I'm Asking for name=nombre    phone#= telefono  email=correo  and the message=mensaje

      so i'm using 4 input fields

       

      and this is the code I'm using:  (The php file is attached)

       

       

       

      // hiding some boxes used for error handling

      en.visible = false;

      ec.visible = false;

      em.visible = false;

       

       

       

      // build variable name for the URL Variables loader

      var variables:URLVariables = new URLVariables;

       

       

      // Build the varSend variable

      var varSend:URLRequest = new URLRequest("form_postal.php");

      varSend.method = URLRequestMethod.POST;

      varSend.data = variables;


       

      // Build the varLoader variable

      var varLoader:URLLoader = new URLLoader;

      varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

      varLoader.addEventListener(Event.COMPLETE, completeHandler);


       

      // handler for the PHP script completion and return of status

      function completeHandler(event:Event):void {

           // remove processing clip

           nombre_txt.text = "";

           telefono_txt.text = "";

           correo_txt.text = "";

           mensaje_txt.text = "";

       

          

           // Load the response from php here

           status_txt.text = event.target.data.return_msg;

      }


      // Add event listener for submit button click

      submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);


      // function ValidateAndSend

      function ValidateAndSend (event:MouseEvent):void {

       

       

           // validate fields

           if(!nombre_txt.length) {

           en.visible = true;

           } else if (!correo_txt.length) {

           ec.visible = true;

           } else if (!mensaje_txt.length) {

           em.visible = true;

           } else {

       


                // ready the variables in our form for sending

                variables.Nombre = nombre_txt.text;

                variables.Correo = correo_txt.text;

                variables.Mensaje = mensaje_txt.text;

                variables.Telefono = telefono_txt.text;

       

          

                // Send the data to PHP now

                    varLoader.load(varSend);

       

          

           } // close else condition for error handling

       

      }

       

       

       

       

       

      I hope someone can help

      If someone needs more info pleas tell me

       

      Thank you

        • 1. Re: Contact Form
          kglad Adobe Community Professional & MVP

          try changing:

           

          varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

           

          to

           

          varLoader.dataFormat = URLLoaderDataFormat.TEXT;

          1 person found this helpful
          • 2. Re: Contact Form
            PakoCancun Level 1

            Hi thanks but

             

            I changed :

             

                 varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

                 to

                 varLoader.dataFormat = URLLoaderDataFormat.TEXT;

             

            but now it prompts me with another error:

             

                 ReferenceError: Error #1069: Property return_msg not found on String and there is no default value.

                 at POSTAL_fla::Postal_1/completeHandler()

                 at flash.events::EventDispatcher/dispatchEventFunction()

                 at flash.events::EventDispatcher/dispatchEvent()

                 at flash.net::URLLoader/onComplete()

             

            and thats when the php file is in the same folder as the swf, because if I take the php file away it gives me this error:

             

                 Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL:      file:///Macintosh%20HD/Users/Admin/Documents/NewFolder/Flash/Web/form_postal.php

                 at POSTAL_fla::Postal_1/frame1()

             

             

            And still i tried it on the server and I do not get any mail

            • 3. Re: Contact Form
              kglad Adobe Community Professional & MVP

              where's your code that references return_msg?

              • 4. Re: Contact Form
                PakoCancun Level 1

                in the PHP file