A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Flash 5 Form & CGI, need help! Please!

  1. #1
    Junior Member
    Join Date
    Sep 2000
    Posts
    8
    Hi all,

    Could someone please help me out. This is my first post and I'm new to flash, I used flash 4 a little and I just now started using flash 5. I like working with flash a lot and look forward to learning more, the potential is awesome. I am not able to make my first flash creation come to life on the web. The description below is lengthy, I figured too much info. is better than too little.

    I am building a form using flash 5, but I started building the form with flash 4. The form has a text input, some check boxes, radio buttons, menus, and a submit button.

    The form input and variables are to be determined by the user and then submitted to a remote server using the post url method.

    The remote server is set up with CGI to receive the form input variables. With the exception of the text entered into the text box by the user, all of the input variable types, names, and value names are pre-determined by the CGI at the remote server. According to the "browser">"view" of the pre-existing form html or CGI?, the checkbox and radio button values when checked or selected="a predefined unique name" and unchecked or not selected="", not on or off).

    There are also pre-existing working forms that post to the remote server and have the identical input variables as the form I am building. In short, I am building a new form with inputs that match all of the input types, names, and variables of the pre-existing forms. My form is just a new graphic design with the pre-existing inputs.

    I have not had too much problem learning the flash graphics, it's a lot of fun, but I do not understand how to make the CGI interface work.

    First, I do not completely understand how and where to define the input variable types, names, and values in my flash 5 checkboxes, buttons, text input box, etc. Some of this is not clear to me, can someone please clarify this for me?

    And Secondly, I do not understand how to add the (CGI or HTML ?) source to my flash 5. I have viewed the source (CGI or HTML ?) of the pre-existing forms in a browser window, this seems to show the input variable types, names. and values.

    Can I somehow copy the pre-existing source and add it to my published flash html file? If this is possible, then how do I do it? What program can I use for this that is newbie friendly? An HTML editor? Aftershock? Director 8? I have Dreamweaver 3. My flash 4 is no longer available it was a trial version. I down loaded activeperl but it looks complicated and I'm not sure if it is working correctly.

    Thank you very much in advance for any help

    scrah


  2. #2
    Moderator
    Join Date
    Aug 2000
    Posts
    1,455
    Hiya scrah!

    I've been working over the past few weeks on my FlashMailer Project. It's a Flash 4 / CGI (Perl) combo to do exactly what you want. Basically, the CGI takes all variables passed to it from Flash and, with the exception of the ones in the ignore list, sends them on in an email to a predetermined address.

    You can visit the FlashMailer site here: http://www.netbreed.co.uk/flashmailer

    The site is still a bit rough around the edges but the downloads are working and you can subscribe to receive updates as and when they are made.

    Let me know what you think!

    Hope this helps!

    NETbreed

  3. #3
    Junior Member
    Join Date
    Sep 2000
    Posts
    8
    Hello NETBreed,

    Thanks for the reply and congrats on the new site and the FlashMailer project. I checked out your site & it looks like your off to a good start.

    Maybe I should start by asking a few general questions, so I can understand the basics. I am new to flash and I dont know much at all about CGI, but I want to learn at least enoph to make this form work, and then I can learn more later.

    I only need to send info from flash to the remote server and not from the server to flash. The info to be sent from flash to the server is not to be e-mail.

    Do I need CGI scripting attached to or included in my flash html file? If so, then how do I do that? and what program is not to complicated to use and that will make this work?

    Aside from my new flash graphics, the form I am building is a duplicate of a pre-existing form that is currently working good. Is there some way to just copy the needed CGI interface code from the pre-existing form and edit it into my flash html?

    I don't even know how to edit the flash html file. Well any insight into this would be most appreciated.

    Thanks again,

    scrah
    [Edited by scrah on 09-24-2000 at 09:41 AM]

  4. #4
    Moderator
    Join Date
    Aug 2000
    Posts
    1,455
    Hiya scrah!

    The CGI script is completely seperate from any HTML file (either the Flash one or the original). It is probably stored in a directory on the webserver called 'cgi-bin', though sometimes they can be stored anywhere. To find out where yours is, look at the original HTML file.

    For the <form> tag you should have something like:

    <form action="/cgi-cin/yourscript.cgi" method="POST">

    The action tells you where your script is located. It's also worth noting the method property too, but more of that later.

    Also take note of the name property of each of the forms elements (usually beginning with '<input'). You'll need to duplicate these names in your Flash variables / text boxes.


    Okay, so we've got this far and you've got lots of notes writetn on your hand at this point ...


    Next in your Flash movie appropriately name all of your Flash form elements to the same as their HTML form counterparts.

    I'm going to presume you have a button which the user presses to submit all this information to the CGI script. In the actionscript for the button, do something like this:

    On (Release)
    Load Variables ("/cgi-bin/yourscript.cgi", "", vars=GET)
    ...do anything else you gotta do here...
    End On

    Now the parts you may need to change are in bold. In the first bit, put the path to your CGI script (the one you noted down earlier).

    For the second bit, you may beed to change the send variables bit when creating the Load variables command. There's a combo box at the bottom of the dialogue box with three options:

    Don't Send
    Send using GET
    Send using POST

    You'll need to change this to match whatever the method property of the original form was.

    Also don't forget to switch the location from Level to Target when creating the Load Variables command (though if you're not sending any info back then it doesn't really matter).

    Okay, you should now be done. Note though that unless you've got a web server installed on your machine you'll need to upload this movie to your server before you can test it as the CGI won't execute.

    I hope this all helps. If you are still stuck send me the original HTMl file and the .fla for the movie (and the CGI script if possible) and I'll have alook at it for you!

    Hope this helps!

    NETbreed

  5. #5
    Junior Member
    Join Date
    Jul 2000
    Posts
    9

    Radio Buttons

    I understand how to do the form part, but I'm trying to create radio buttons, and it's not working.
    This is what I have so far:
    http://www.excitestores.com/stores/c...tailer_cd.html

    Everything works but the radio buttons. The radio buttons are movie clips and can be found as one of the sample fla in flash 5. I've tried to make it so when one of the radio buttons is click, it sets a variable equal to 1. Then when I hit the submit button, I've used if statements to define what will be sent. As it is now, it will send the last one of the radio buttons, no matter which one is selected. (i.e. it will always define age as 44+) Any ideas how to make this work?

    Thanks!

  6. #6
    Moderator
    Join Date
    Aug 2000
    Posts
    1,455
    Hiya anewdesign!

    My guess is that there's an error in your logic for checking the selected value of a radiobutton set. Can you post the ActionScript used here (or send it to me at Steve@netbreed.co.uk).

    Regards,

    NETbreed

  7. #7

    Perl Special Characters

    I have a somewhat related issue that I think you can help me with. I am writing a perl script that will edit text files and write them back out in URL encoding. The problem is PERL isn't converting special characters. Ex. "%" is showing up as "%25". I am using the following to decode:
    Code:
    foreach $pair (@pairs) {
    	($key, $value) = split (/=/, $pair);
    	$key =~ tr/+/ /;
    	$key =~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/eg;
    	$value =~ tr/+/ /;
    	$value =~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/eg;
    	
    	#$value =~s/<!--(.|\n)*-->//g;
    	
    	if ($formdata{$key}) {
    		$formdata{$key} .= ", $value";
    	} else {
    		$formdata{$key} = $value;
    	}
    }
    Any Ideas?

  8. #8
    Junior Member
    Join Date
    Jul 2000
    Posts
    9
    Hi Net-

    Maybe this will help:

    I have a movie clip, which contains buttons which look like radio buttons. On each of the buttons in the mc, there is an action code similar to this:
    ____________________________________________
    on (release) {
    gotoAndStop (1);
    /:radio = "\"radio 1\"";
    }
    ________________________________________
    There are 6 frames in the mc, and at each frame, the radio dot will move to the specific button. For example, on the second button, the action code is as follows:
    _________________________________________
    on (release) {
    gotoAndStop (2);
    /:radio = "\"radio 2\"";
    b = 1;

    }
    __________________________________________

    This works great and I don't need any help here. To understand it more, you can pull up the sample file in flash 5 titled "Advanced Buttons"

    What my question is, how can I take this information and pass it to a cgi form mailer. I can get all of my text boxes to work, I just can't figure out the radio buttons. I am thinking somewhere along the lines of putting in multiple if statements on the submit button. like:
    __________________________________
    if (radio = "radio 1") {
    response20 = "age of person";
    }
    _______________________________

    However, I can't get that to work. As you can see, "response20" is the variable that needs to have the correct information to send it to the cgi form.

    Any ideas?

    Thanks!

    Heather

  9. #9
    Moderator
    Join Date
    Aug 2000
    Posts
    1,455
    Hiya anewdesign!

    I think I've found your problem!

    When doing string compares you need to use the following:

    if (radio eq "radio 1") {
    response20 = "age of person";
    }

    The important bit is in bold. eq is the operator to compare two strings. This particular logic is correct, however there is another problem I can see:

    on (release) {
    gotoAndStop (1);
    /:radio = "\"radio 1\"";
    }

    This code fragment sets radio in the main timeline to be "radio 1". This is includes the quotation marks in the string (i.e. /:radio eq ""radio 1"").

    Just change the button ActionScripts to:

    on (release) {
    gotoAndStop (1);
    /:radio = "radio 1";
    }

    ...and this should work. I hope this works for you. If not them mail the the .fla and I'll have a look!

    Regards,

    NETbreed

  10. #10
    Junior Member
    Join Date
    Jul 2000
    Posts
    9
    NETbreed:

    Can I just tell you, you rock! The thing finally works! Thanks so much for your help.

    Heather

  11. #11
    Moderator
    Join Date
    Aug 2000
    Posts
    1,455
    Hi Heather!

    No problems. Glad I could be of service. If you need any more help then just let me know!

    Regards,

    Steve Webster
    NETbreed Web Design

  12. #12
    Junior Member
    Join Date
    Sep 2000
    Posts
    8
    Hi NETBreed,

    Thank you very much for your help.

    I have a problem that I have been trying to solve for quite a while, and I really need some help bad.

    Could you or someone please take a look at my post where I describe the problem, the post is at:

    Scripting & Backend > (Subject title): "Flash 5, multiple variables have same name in CGI script"

    Thank's again for the help.
    scrah
    [Edited by scrah on 09-27-2000 at 09:22 PM]

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center