6 Replies Latest reply on Sep 15, 2006 1:23 PM by Blakice_iceman

    Trying to send info to a CFM file, with UI Components, using GET method

    Blakice_iceman
      Hello,

      I'm using one DateField and three ComboBoxes to submit the entered data to a CFM file. The form with those components are inside of a movie clip on a full flash site. How do I get the CFM file to recognize the DateField entry and the ComboBox entries in its query string? Thanks for any help! Here is the code I started with (which I know is way wrong for the most part) for the form actions:

      Currently I'm getting this in the URL using the actionscript I have below: https://reservations.ihotelier.com/onescreen.cfm?DateIn=undefined&
      Length=%5Flevel0%2Ecover%2Eholder%2Elower%5Fmc%2Einstance12%2ELength&
      Adults=%5Flevel0%2Ecover%2Eholder%2Elower%5Fmc%2Einstance12%2EAdults&
      Children=%5Flevel0%2Ecover%2Eholder%2Elower%5Fmc%2Einstance12%2EChildren&HotelID=13337&
      LanguageID=1&%5FchildCounter=2&focus%5Fmc=%5Flevel0%2Ecover%2Eholder%2Elower%5Fmc%2Einstan ce12%2EdepthChild1



        • 1. Re: Trying to send info to a CFM file, with UI Components, using GET method
          TimSymons Level 1
          I have a couple of questions.

          1) It appears that you are defining a variable and then setting it to itself in the definition. Is that right? (That is why you are getitng paths in your URL).

          2) I have never used the method you are using, so I can't with that but why are you not using the LoadVars class. Your code would look like this if you wanted to use it:

          var send_lv:LoadVars = new LoadVars();
          var results_lv:LoadVars = new LoadVars();
          send_lv.DateIn = showToday;
          send_lv.Length = Length; // still not sure what variable you are using here.
          send_lv.Adults = Adults;
          send_lv.Chidlren = Children;
          send_lv.HotelID = 13337;
          send_lv.LanguageID = 1;
          submit.onRelease = function() {
          send_lv.sendAndLoad("https://reservations.ihotelier.com/onescreen.cfm", results_lv, "GET");
          };

          This will allow you to send information to the CFM page and have it return information back to your Flash movie without leaving the page you are on. If you want to send information to the CFM page and also leave the page you are on and replace it with the response from the CFM page then just use the send() function instead of the sendAndLoad() function.

          Tim
          • 2. Re: Trying to send info to a CFM file, with UI Components, using GET method
            Blakice_iceman Level 1
            Hello and thank you so much for replying to my question.

            As far as the variables go, I want whatever the user selects to define the variable value. For example, for the DateField, when someone selects a certain date I need that date to be sent as the value of that variable. Another example, when a user selects the option for "2" under the Children variable, I need the number "2" sent as the value for that variable to the CFM file as well. I am just not quite sure how to tell the variables what their values are, when the values can change depending on what the user selects. How would I go about setting the values initially for the variables?

            And yes, I just need the form on the flash site to send and show the response inside the CFM file itself, so I don't need to sendAndLoad.

            Again, thanks for the reply.

            Elijah
            • 3. Re: Trying to send info to a CFM file, with UI Components, using GET method
              TimSymons Level 1
              To get the information will depend on how you are letting the user enter it into the form. If ther are all textfields then you could use:

              textfield_name.text

              If you are using other components like radio buttons and checkboxes then each of those will have a parameter for the value that they represent. The Help Files on components should show you what you need.

              Also, you should probably move the variable settings inside the onRelease function so that the variables are set when the user clicks the button.

              Tim
              • 4. Re: Trying to send info to a CFM file, with UI Components, using GET method
                Blakice_iceman Level 1
                Hello Tim,

                I am using 1 DateField, and 3 ComboBoxes for my components. Here are the following variables:

                DateIn = DateField
                Length = ComboBox
                Adults = ComboBox
                Children = ComboBox
                submit = Button

                In all the ComboBoxes the user only has numbers to choose from. Those and the DateField are the only bits of information I need sent to the CFM file. I have tried looking this up in the help files, but there doesn't seem to be anything that is clicking with this type of scenario to me. Thank you for the help again.

                Elijah
                • 5. Re: Trying to send info to a CFM file, with UI Components, using GET method
                  TimSymons Level 1
                  OK. So lets take the Length combo box.

                  You can get the value the user has selected by using the following code:

                  Length.value;

                  This will return 1 or 2 values. If you have only defined a label for each option then it will return the label. If you have also defined a data for each option then it will return the data item.

                  So in your onRelease function you should soemthing like this:

                  submit.onRelease = function () {
                  var send_lv:LoadVars = new LoadVars();
                  send_lv.Length = Length.value;
                  send_lv.Adults = Adults.value;
                  send_lv.Children = Children.value;
                  send_lv.DateIn = DateIn.selectedDate;
                  send_lv.send("url....","GET");
                  };

                  Note: For the DateIn.selectedDate to return something besides "undefined" you have to supply the datefield with the acceptable range of dates for selection.

                  Tim
                  • 6. Trying to send info to a CFM file, with UI Components, using GET method
                    Blakice_iceman Level 1
                    Hello again Tim,

                    Ok, I used the action script you gave me in your last post, it looks like it is the one. However, now I'm having an issue with
                    the DateField entry being recognized as an actual date by the CFM file. By the way, this is the URL that pops up after sending the values to the CFM file: https://reservations.ihotelier.com/onescreen.cfm?DateIn=Thu%20Sep%2028%2000%3A00%3A00%20G MT%2D0700%202006&Children=3&Adults=2&Length=3
                    It really should look more like this: https://reservations.ihotelier.com/onescreen.cfm?DateIn=09%2F28%2F2006&Length=3&Adults=3& Children=1&Rooms=1&HotelID=5737&LanguageID=1&submit.x=15&submit.y=13

                    Here is the code I'm using (with the selectedDate range):