1 Reply Latest reply on Jul 15, 2009 12:43 AM by ocbfd

    Endless problems with contact email form

    ruesss

      [Woops - originally this was posted in AS 3]

       

      Hi there,

       

      I have tried about as many tutorials as I can find online to create a contact form within my flash that emails me when someone fills out the forms, including a very good step by step at VTC. What I have found is that most of these tutorials start with the assumption that you're creating the contact form on a blank flash canvas, which is reality, is not always the case. So while I am sometimes able to get the forms to work if I do it on a brand new Flash movie, the moment I try to recreate the form within my current flash file, it stops working. I have mostly tried to recreate the contact form as a seperate movie within my flash file on it's own layer and have tried placing the Submit button within the contact form movie and also outside of it - neither works of course.

       

      Could anyone steer my in the right direction? Using CS3 btw.


      Here's the info:

      So according the image, my contact form is called "mcForm" which is a movie clip within the larger .fla on its own layer.


      flash1.JPG

      The actions that are associated with the 1st frame in the "actions" layer above are as the following:

      flash2.JPG


      Here is the code itself repasted:


      -----------------------------------------------------------

       

      stop();

       

      var gatherForm:LoadVars = new LoadVars();

       

      //Send form function

       


      function sendForm():Void
      {
          gatherForm.receipient = "my@email.com";
          gatherForm.realname = mc_form.txt_name.text;
          gatherForm.subject = "Form Results";
          gatherForm.email = mc_form.txt_email.text;
          gatherForm.comments = mc_form.txt_comments.text;
          gatherForm.send("/cgi-bin/formmail/formmail.pl","blank","POST");
      }

       

      //End send form

       


      //Begin button actions
      mc_form.btn_submit.onRelease = function():Void
      {
          if(mc_form.txt_name.text == "")
          {
              _root.gotoAndStop("error")
          }
          else
          {
              sendForm();
              _root.gotoAndStop("correct")
          }
      }
      //End button actions

       

      ----------------------------------------------------------------

       

      Thanks so much for any help that can be provided

        • 1. Re: Endless problems with contact email form
          ocbfd

          You should put all of your actionscript in one frame in the root.  Use trace statements to monitor what's happening.

           

          Here's example of tracing a function call and one of the loadVars:

           

          trace("sendForm() called");

          trace("mc_form.txt_name.text=" + mc_form.txt_name.text);

           

          I think if you get all your code in one place and use traces you can solve the problem.

           

          If that doesn't work, post your fla here.