Connecting Tech Pros Worldwide Forums | Help | Site Map

Firefox form submiting problem, works fine in ie

Newbie
 
Join Date: Apr 2007
Posts: 1
#1: Apr 6 '07
Hello, I am having a problem with developing my form, when i click submit in ie the form validates itself and is submitted but when I open the form in firefox it will not validate or submit the form, it simply open up outlook express.... any help would be really appreciated guys..

thank you, the code of my form and javascript is below

Expand|Select|Wrap|Line Numbers
  1.                           <script language="javascript1.2">
  2.                               function validateForm(f)
  3.                 {              
  4.                                   event.returnValue = true;
  5.  
  6.  
  7.                                      if (f.name.value == "")
  8.                              {
  9.                                   alert("Sorry you must fill in the name field");
  10.                                   event.returnValue = false;
  11.                              } 
  12.  
  13.                                 z = document.forms['one'].contact.value;
  14.                                  if ((f.contact.value == "") || 
  15.                                   (isNaN(parseInt(z))) )
  16.                              {
  17.                           alert("Sorry you must enter a contact telephone number"); 
  18.                                           event.returnValue = false;
  19.                              } 
  20.  
  21.  
  22.                              if ((f.email.value.indexOf("@") == -1) || 
  23.                                  (f.email.value.indexOf(".") == -1))
  24.                              {
  25.                               alert("Sorry the email field does not contain a valid email address"); 
  26.                                   event.returnValue = false;
  27.                              }
  28.  
  29.  
  30.                                        if (document.forms['one'].catagory.options[0].selected )
  31.                              {
  32.                                   alert("you must choose a catagory");
  33.                                   event.returnValue = false;
  34.                              } 
  35.  
  36.  
  37.  
  38.                             x = document.forms['one'].loan.value;
  39.                             if (isNaN(parseInt(x))) {
  40.                            alert("Please enter in a number into the loan field");
  41.                             event.returnValue = false;
  42.                                                     }
  43.  
  44.  
  45.                 }          
  46.                               </script>
  47.  
  48.  
  49.  
  50.     <form action="mailto:SOMEEMAIL@SOMEEMAIL.com" method="post" enctype="multipart/form-data" id="one" onSubmit="validateForm(this)">
  51.                                 <fieldset>
  52.                                 <legend>Applicant</legend>
  53.  
  54.                                 <p>
  55.                                   <label for="name"><span id="ast">*</span>Full name:</label>
  56.                                   <input type="text" name="name" id="name"accesskey="n" tabindex="1"></p>
  57.  
  58.  
  59.                                 <p>
  60.                                   <label for="contact"><span id="ast">*</span>Contact Tel:</label>
  61.                                   <input type="text" name="contact" id="contact" accesskey="c" tabindex="2">
  62.                                 </p>
  63.  
  64.  
  65.                                   <label for="email"><span id="ast">*</span>Email:</label>
  66.                                   <input type="text" name="email" id="email" accesskey="e" tabindex="3">
  67.                                   <br>
  68.  
  69.                                 </fieldset>
  70.  
  71.  
  72.                                 <fieldset>
  73.                                 <legend>Income Details</legend>
  74.  
  75.                               <p>Employment type:</p>
  76.  
  77.     <label for="employ" style="width:8em; margin:0; text-align:left;" >Empolyed
  78.     <input type="checkbox" name="employ" value="employed" id="employ" accesskey="m" tabindex="4">
  79.     </label>
  80.     <label for="self" style="width:8em; margin:0; text-align:left;" >Self employed
  81.     <input type="checkbox" name="self" value="self-employed" id="self" accesskey="s" tabindex="5" >
  82.     </label><br/><br/>
  83.     <p><label for="sal">Salary:</label>
  84.       <input type="text" name="sal" id="sal" accesskey="s" tabindex="6">
  85.     </p>
  86.                               </fieldset>
  87.  
  88.                                 <fieldset>
  89.                                  <legend>Mortage details</legend>
  90.                                  <p>
  91.                                    <label for="cat"><span id="ast">*</span>Catagory:</label>
  92.  
  93.                                  <select name="catagory" accesskey="v" tabindex="7" id="cat" >
  94.  
  95.                                  <option>Please Select</option>
  96.                                     <option>Commercial</option>
  97.                                     <option>First Time Buyer</option>
  98.                                     <option>100% Mortgage</option>
  99.                                     <option>Re-Mortgage</option>
  100.                                     <option>Trading Up</option>
  101.                                     <option>Investment</option>
  102.                                     <option>Self Build</option>
  103.                                  </select></p>
  104.  
  105.                                  <p>
  106.                                    <label for="loan"><span id="ast">*</span>Loan amount:</label>
  107.                                     <input type="text" name="loan" id="loan" accesskey="l" tabindex="8"></p>
  108.  
  109.                                 </fieldset>
  110.  
  111.              <input type="submit" name="Sub" id="sub" tabindex="9" value="Submit application" style="margin-top:10px;">
  112.  
  113.     <input name="clearpage" id="clearpage"type="reset" tabindex="10" value="Clear form" style="margin-top:10px;">
  114.  
  115.  
  116.  
  117.                             </form>
  118.  

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,565
#2: Apr 6 '07

re: Firefox form submiting problem, works fine in ie


I'm not much of a javascript guy but your html has a lot of errors. Validate and fix those.
Expert
 
Join Date: Oct 2006
Location: NC
Posts: 1,722
#3: Apr 6 '07

re: Firefox form submiting problem, works fine in ie


FYI, never post your email address in a public place. That is a great way to get spammed like crazy. The reason your form opens in Outlook Express is that your form action is mailto:
Reply