13 Replies Latest reply on Feb 12, 2007 5:08 AM by Sketchsta

    More Flash Form questions

    Sketchsta Level 1
      I'm need some info on sending Forms via E-mail, that contain ComboBoxes, CheckBoxes or Radio Buttons..
      i have no problems sending text fields, but components like comboBox, checkBox etc.. i have no idea how to get it to work.

      I tried using the same method i use for text fields, but i get nothing in the email.

      I'm still searching for info on the net, but i would appreciate any help.

        • 1. Re: More Flash Form questions
          kglad Adobe Community Professional & MVP
          use the help files. they pretty good for the components (unless you want to customize them). in particular, they have examples of how to use them all.

          check under components language reference and you'll find them listed alphabetically. you can usually get a quick how-to-use by clicking the first item "using the" whatever component and then clicking "creating an application with" whatever component.
          • 2. Re: More Flash Form questions
            Sketchsta Level 1
            yeah i just found those about 30mins ago, im still reading through, but i dont see anything about sending to PHP ( or sending to anything )..

            it just tells you how to use each component and an example of how to use it.

            I'm affraid im not advanced enough to improvise with components and PHP.. people who know AS and PHP really well could think of a way to use the info from the help files to get what they want..
            but im not as advanced yet, all i know is what i just read, and have no idea how to improvise to get what i need.
            • 3. Re: More Flash Form questions
              Sketchsta Level 1
              I STILLLL cant get flash to send component variables to PHP...

              i went through ALLL the help files on ComboBox, CheckBox, and Radio Button...and still NOTHING!!!!

              i need help, this is getting really frustrating..
              it should be easy
              • 4. Re: More Flash Form questions
                Peter Lorent Level 2
                For instance, the item the user selects in a combox is its property 'selectedItem'. Usually you assign a label and a data property to the items in the combox. When you want to send the data value to a PHP script you would add that data property to a LoadVars object:
                where 'myCombobox' is the instance name of the combobox.
                Then send that value to a PHP script using the sendAndLoad method of the LoadVars Class (like you already do with an email form).
                In the help-files for the components you will find the property that represents a selected value(if applicable) for each component.
                • 5. More Flash Form questions
                  Sketchsta Level 1
                  ok, i really must be doing something wrong... heres the AS code (taken straight from the help files...I just commented out the trace functions, and changed the data and label names..)
                  • 6. Re: More Flash Form questions
                    Peter Lorent Level 2
                    Yes, you are really doing something wrong. Now, let's focus on the combobox.
                    You just want to assign the selected value to a new property of a loadvars object. You only need a listener for the change event if you want other objects to reflect a change in their state when the value in the combobox changes. So, we have the combobox on the stage with an instance name 'combo_box':

                    combo_box.addItem({data:btn1, label:"this is NO"});
                    combo_box.addItem({data:btn2, label:"this is YES"});
                    combo_box.addItem({data:btn3, label:"this is MAYBE"});

                    We want to send a value from the combobox and to check if it works we want to catch the respons from the PHP-script. Hence, we are going to use two LoadVars objects:

                    var sender_lv:LoadVars = new LoadVars();
                    var receiver_lv:LoadVars = new LoadVars();

                    For the receiver_lv object we define a onLoad callback handler:

                    trace(this.result); // simply traces what we have send to the PHP-script
                    } else {
                    trace("Something is wrong here.");

                    Now we are ready to send the selected value of the combobox to the PHP script when the user clicks the send button:

                    send_btn.onRelease = function(){
                    //assign the selected value in the combobox to a (new) property of the send LoadVars object
                    sender_lv.combobox = combo_box.selectedItem.label; //using the label property here
                    sender_lv.sendAndLoad(" http://wftd.hq.org.au/~sketch/contact/combo.php",receiver_lv,"POST");

                    This will send a variable 'combobox' to the PHP-script, holding the selected value of the combobox.

                    Let's keep the PHP-script simple: (save this on the server as combo.php, just for testing purposes)

                    echo "&result=$combobox";

                    This will return the selected value to Flash where we simply trace that value in the onLoad handler of our receive_lv object. And that wraps up the procedure...
                    • 7. Re: More Flash Form questions
                      Sketchsta Level 1
                      Ohh man... I suck at this... =(

                      that works a treat, i even tried it in the PHP i've been working on until now, to see if it would send to my email... and it did, it works great..

                      I'm definately copying your post for future reference..i know im gonna need it..

                      I have just finished the form now tho...but instead of having checkBoxes and pullDown menus...i've got a whole lot of text fields...
                      doesnt look too good...
                      but I kept messin arownd with the layout when it sends to email, and it's alrite.. abit hard to read tho, because all the font is the same, so it makes it abit hard to see where the Headings are and the Answers begin..

                      I been trying to add things like:
                      <strong> <b> <h2> etc...
                      but none would work...the tags just appear in the email..

                      I'm sorry to ask, but is there a certain way you have to do things, to have fontStyle sent to email??

                      If im being a pain, just tell me to shut up.. =)
                      • 8. Re: More Flash Form questions
                        Peter Lorent Level 2
                        You need to code that in the PHP script:
                        $message = "
                        <b>html message</b><br>
                        <font color=\"red\">here</font>
                        • 9. Re: More Flash Form questions
                          Sketchsta Level 1
                          I tried it, but it just gets displayed in the email...

                          I'm using:
                          $EmailBody = "....";

                          you taught me that one.. =)
                          • 10. Re: More Flash Form questions
                            Peter Lorent Level 2
                            To send HTML mail, the Content-type header must be set.

                            • 11. Re: More Flash Form questions
                              Sketchsta Level 1

                              Forget it...i'm too dumb to make this work...

                              Thanx for all your help LuigiL, I appreciate it. and maybe i'll get this to work some day, but right now, im too dumb for even this simple code..

                              thanx again dude..
                              • 12. Re: More Flash Form questions
                                Peter Lorent Level 2
                                You're welcome. If I had the time I would do it for you but... on a deadline myself, unfortunately.
                                • 13. Re: More Flash Form questions
                                  Sketchsta Level 1
                                  thats alrite dude.. Im gratefull you put up with me for as long as you did..
                                  this Order Form im doing was supposed to be done 2 days ago, the only reason I didnt finish it sooner was cuz my boss didnt pay me for the previous job... but now i have no excuse..

                                  Im just gonna upload it and be done with it... hopefully he wount complain.. it's not the worst job i've done. =P

                                  Good luck, hope your work goes smoothly..