SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member Braiii's Avatar
    Join Date
    Mar 2003
    Location
    Boston
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question LoadVars to CGI?? Feedback form problems.

    I'm currently trying to submit a form to a CGI form-mail page, but am running into connection issues. I'm not passing the information correctly because I'm not getting anythign submit to the form.

    My form submit button is setup like this:

    on (release) {
    formData = new LoadVars();
    formData.PTCcode-email == "yes";
    formData.PTCcode-flatfile == "yes";
    formData.PTCcode-database == "job_description";
    formData.PTCcode-recipient == "xxxxx@xxx.com";
    formData.PTCcode-subject == "Form information";
    formData.loadVariables
    formData.send("http://www.xxx.com/cgi/common/form-mail.pl","_root.content","post");
    gotoAndStop("Sent");
    }

    Is this correct, I thought it was...but nothing seems to be hitting the .pl file.

    Also, I have in the form, input text fields defined as followed:

    First Name: variable name = "first_name"
    Last Name: variable name = "last_name"

    Company: variable name = "company"
    Phone: variable name = "phone"

    Comments: variable name = "commments"

    All the text input fields are on the .pl file...please help if you see any problems with what I have setup.


    Thanks - Rob

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A couple of issues. You need to assign the values of your form input fields to the LoadVars Object I did the first_name one for you, you must do the rest.

    You should move the action off the mc instance and into the timeline on a frame. also == is for comparison = is for assignment. Does the script return anything to the movie? LoadVars.send() will open a new window. I assume this is not what you want. Use sendAndLoad instead.

    Code:
    btn.onRelease = function() {
     formData = new LoadVars();
     formData.first_name = _root.first_name;
     formData.PTCcode-email = "yes";
     formData.PTCcode-email = "yes";
     formData.PTCcode-flatfile = "yes";
     formData.PTCcode-database = "job_description";
     formData.PTCcode-recipient = "xxxxx@xxx.com";
     formData.PTCcode-subject = "Form information";
     formData.sendAndLoad("http://www.xxx.com/cgi/common/form-mail.pl",this,"post" );
    	formData.onLoad = function(success) {   
      if (success) {
       gotoAndStop("Sent" );
      }
     }
    }

  3. #3
    SitePoint Member Braiii's Avatar
    Join Date
    Mar 2003
    Location
    Boston
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried to do this but I get this for the output:

    Scene=Scene 1, Layer=Lead in, Frame=5: Line 11: Left side of assignment operator must be variable or property.
    formData.PTCcode-database = "job_description";
    Scene=Scene 1, Layer=Lead in, Frame=5: Line 12: Left side of assignment operator must be variable or property.
    formData.PTCcode-recipient = "xxxx@xxxx.com";
    Scene=Scene 1, Layer=Lead in, Frame=5: Line 13: Left side of assignment operator must be variable or property.
    formData.PTCcode-subject = "Form information"

    It seems to be happening because the "==" was replaced with "=", the formData.PTCcode-xxx = "xxx" is supposed to represent a hidden field with a value. I'm sure you wrote that right, but I don't think I have it setup to be a value to be submitted correctly.

    I moved the script of the button instance of "Submit" and on to the time line where it stops. I renamed the "btn.onRelease" to "submit.onRelase"

    The script shouldn't return anything to the movie, the success of this function goes to "gotoAndStop("Sent" );" and this frame label shows a thank you page for the submission. After using the script I don't seem to be getting to "gotoAndStop("Sent" );" because it stays on the form page instead of going to the thank you frame "Sent".

    I noticed you placed "_root." before the variables, why is this? I have this flash movie coming up in a template which is behind another flash movie already running, if "_root." is used will it mean the "_root" of the entire template which is not this movie?

    Code:
    submit.onRelease = function() {
     formData = new LoadVars();
     formData.first_name = first_name;
     formData.last_name = last_name;
     formData.email = email;
     formData.phone = phone;
     formData.comments = comments;
     formData.PTCcode-email = "yes";
     formData.PTCcode-email = "yes";
     formData.PTCcode-flatfile = "yes";
     formData.PTCcode-database = "job_description";
     formData.PTCcode-recipient = "xxxxx@xxxx.com";
     formData.PTCcode-subject = "Form information";
     formData.sendAndLoad("http://www.xxxx.com/cgi/common/form-mail.pl",this,"post" );
     formData.onLoad = function(success) {   
      if (success) {
       gotoAndStop("Sent" );
      }
     }
    }
    stop();
    Thanks - Rob

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't see your movie so I have done the best I can. The reason you are getting the errors is because I don't think you can have a - in a variable name in flash. It thinks you are trying to subtract the two variables. You could use them but you would need to evalaute them as an expression like.
    Code:
     formData["PTCcode-email"]

  5. #5
    SitePoint Member Braiii's Avatar
    Join Date
    Mar 2003
    Location
    Boston
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are showing me a compiled swf. That does me know good. What kind of script is the form being submitted to? Perl? Can you send the perl script and the .fla?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •