By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,450 Members | 980 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,450 IT Pros & Developers. It's quick & easy.

submitting form

Claus Mygind
100+
P: 571
I am having some trouble submitting a form in IE. Works fine with FireFox.

I have tried two methods.

method #1
Expand|Select|Wrap|Line Numbers
  1. function validateForm(form)
  2.     {
  3.        if (document.getElementById("NAME").value == "")
  4.        {
  5.          alert("You left the name blank.");
  6.          return false;
  7.        }else{
  8.          if (document.getElementById("EMAIL").value == "")
  9.          {
  10.            alert("You did not give me an email address.How can I email you!");
  11.            return false;
  12.        }else{
  13.            return true();
  14.  
  15.        }
  16.      }
  17.    }
  18.  
  19. <FORM METHOD=POST     ACTION="myApp.exe" onSubmit="return validateForm(this)">
  20.  
  21. <input type="submit" value="Add My Name To Guest Book">
  22.  
  23.  
method #2
Expand|Select|Wrap|Line Numbers
  1. function validateForm(form)
  2.     {
  3.        if (document.getElementById("NAME").value == "")
  4.        {
  5.          alert("You left the name blank.");
  6.          return false;
  7.        }else{
  8.          if (document.getElementById("EMAIL").value == "")
  9.          {
  10.            alert("You did not give me an email address.How can I email you!");
  11.            return false;
  12.        }else{
  13.            form.submit();
  14.  
  15.        }
  16.      }
  17.    }
  18.  
  19. <FORM METHOD=POST     ACTION="myApp.exe" onSubmit="return false"
  20. >
  21.  
  22. <input type="button"    id = "sendName" name = "sendName"             value="Add My Name To Guest Book" onClick="validateForm(this.form);"> 
  23.  
On option #2 I get an error on the form. It is transmitted as null.
Aug 15 '08 #1
Share this Question
Share on Google+
1 Reply


Claus Mygind
100+
P: 571
Never mind bad coding on my part not shown in example
Aug 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.