2 Replies Latest reply on May 7, 2011 2:28 AM by jiggy1965

    flash form doesn't work

    jiggy1965 Level 1

      I have a flash form that although it does exactly the same as its html version (just passing variables) doesn't work. It doesn't redirect to the right page, processing the send variabeles and sending a custom email.

       

      This is the html form that works just fine:

      
      
      <form action="http://www.gezonderpersoneel.nl/calculator" method="post">
           Branche: <input type="text" name="branche" value="1" /><br />
           FTE: <input type="text" name="fte" value="1" /><br />
           Verzuimkosten: <input type="text" name="verzuimkosten" value="1845" /><br />
           Loonsom: <input type="text" name="loonsom" value="45000" /><br />
           Sickness: <input type="text" name="sickness" value="4.1" /><br />
      
           <h1>Ja, ik wil graag mijn resultaat ontvangen per mail</h1>
      
           <p>
                <table cellpadding="0" cellspacing="0" border="0">
                     <tr>
                          <td>
                               Bedrijfsnaam:
                          </td>
                          <td></td>
                          <td>
                               <input type="text" name="company" value="" style="width: 221px;">
      
                          </td>
                     </tr>
                     <tr><td style="height: 4px;"></td></tr>
                     <tr>
                          <td>
                               Functie:
                          </td>
                          <td></td>
                          <td>
      
                               <input type="text" name="function" value="" style="width: 221px;">
                          </td>
                     </tr>
                     <tr><td style="height: 4px;"></td></tr>
                     <tr>
                          <td>
                               Aanhef:
                          </td>
                          <td style="width: 15px;"></td>
      
                          <td>
                               <select name="salutation">
                                    <option value="heer">Dhr.</option>
                                    <option value="mevrouw">Mevr.</option>
                               </select>
                          </td>
                     </tr>
                     <tr><td style="height: 4px;"></td></tr>
      
                     <tr>
                          <td>
                               Voornaam / achternaam:
                          </td>
                          <td></td>
                          <td>
                               <input type="text" name="first_name" value="" style="width: 100px;">
                               /
                               <input type="text" name="last_name" value="" style="width: 100px;"> *
                          </td>
      
                     </tr>
                     <tr><td style="height: 4px;"></td></tr>
                     <tr>
                          <td>
                               E-mail adres:
                          </td>
                          <td></td>
                          <td>
                               <input type="text" name="email" value="" style="width: 221px;"> *
                          </td>
      
                     </tr>
                     <tr>
                          <td colspan="3" height="4"></td>
                     </tr>
                     <tr>
                          <td colspan="3">
                               <input type="checkbox" style="border: none; background: none;" name="newsletter" value="1">
                               Ja, ik wil in de toekomst op de hoogte gehouden
                               <br />worden van nieuws over Gezonder Personeel.
                          </td>
      
                     </tr>
                </table>
           </p>
      
           <p>
                <input type="submit" class="button" name="submit_step2" value="Versturen" />
           </p>
      
      </form>
      
      

       

      As you can see it's just a form - no hidden scripts - and sends variables to the correct url.

       

      I've turned it into a flash form which is just a button which sends the exact same variables as above, but now the browser isn't redirected to the same page. Although the variables are sent which I can check in Firebug. It doesn't redirect to the same page as the html form and all variables are therefore not processed and no email is sent. The only thing I had to workaround is the variable name 'function' which in AS is a reserved word. Bypassed that by using array notation.

       

      It's just like the url the variables are send to can see whether the form is sent through html or flash?

       

      Can someone see my mistake or explain to mee what could cause the flash form not to work? Here is the flash code, quite simple:

       

      mybutton.onPress = function()
      {
           var my_lv:LoadVars = new LoadVars();
           my_lv.branche = "1";
           my_lv.fte = "1";
           my_lv.verzuimkosten = "1845";
           my_lv.loonsom = "50000";
           my_lv.sickness = "4.1";
           my_lv.company = "Working Ltd";
           my_lv["function"] = "Flash Designer";
           my_lv.salutation = "heer";
           my_lv.first_name = "John";
           my_lv.last_name = "Doe";
           my_lv.email = "info@testmail.nl";
           my_lv.newsletter = "1";
           mv_lv.submit_step2 = "Versturen";
           my_lv.send("http://www.gezonderpersoneel.nl/calculator","_blank","POST");
      };